[whatwg/dom] Elements with Proxy, Fallback, Replacement, or Substitute Elements (Issue #1232)

### What problem are you trying to solve?

What if DOM elements could provide proxy, fallback, replacement, or substitute elements for themselves for various scenarios through a common interface, scenarios like providing shadow trees or _accessibility surrogates_?

### What solutions exist today?

The DOM includes means of accessing and using [shadow trees](https://dom.spec.whatwg.org/#shadow-trees). This approach could supplement, could be interoperable with, the existing solution for accessing elements' shadow trees.

Various solutions exist for [Web accessibility](https://www.w3.org/WAI/) such as placing [ARIA attributes](https://www.w3.org/WAI/standards-guidelines/aria/) on documents' elements. Providing a means for elements to provide proxy, fallback, replacement, or substitute elements for themselves would enable _accessibility surrogates_, alternative elements custom-tailored for accessibility scenarios. This capability might be useful for input form elements as well as for developers' custom elements.

### How would you solve it?

I would first consider extending the `Element` interface in a manner resembling:

```webidl
partial interface Element
{
  Element? getProxy(DOMString name, optional object context);
  Element? getProxyNS(DOMString? namespace, DOMString name, optional object context);
  ...
}
```

With such methods on `Element`s, developers would be able to query arbitrary document elements to see if they have proxy, fallback, replacement, or substitute elements for various indicated scenarios.

```js
var shadow_dom = element.getProxy('shadow');
var wai_aria = element.getProxy('wai-aria');
```

### Anything else?

Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1232
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1232@github.com>

Received on Friday, 27 October 2023 05:21:06 UTC