Open jlp-craigmorten opened 7 months ago
Having a quick play it seems:
CSS
is not defined errors. Browser support is reasonable (REF: https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape_static#browser_compatibility) but depending on the needs of this library, it may be not suitable to assume CSS
is defined. There are polyfills available, see https://github.com/mathiasbynens/CSS.escape/blob/master/css.escape.js.
Triaging from https://github.com/guidepup/virtual-screen-reader/issues/48
When
computeAccessibleDescription(element)
is passed an element that is not attached to thedocument
it throws the following error:The issue stems from https://github.com/eps1lon/dom-accessibility-api/blob/d7e6e3dbea2460777d1355406c8d0899d5346a2d/sources/util.ts#L96C16-L96C32:
node.getRootNode
resolves to thenode
itself.getElementById()
is a method unique to theDocument
interface and thus doesn't exist on thenode
and we get an error.To reproduce:
There are some options:
node.ownerDocument
in all cases - there appears to be precedent for just using this elsewhere in the project (opposed to feature detectingnode.getRootNode
). Not certain what the impact would be here?root.querySelector(`#${CSS.escape(id)}`);
as an alternative togetElementById()
.