eps1lon / dom-accessibility-api

Implements https://w3c.github.io/accname/
MIT License
101 stars 29 forks source link

fix: handle detached nodes for accessible descriptions #1027

Open jlp-craigmorten opened 9 months ago

jlp-craigmorten commented 9 months ago

Fixes #1026

Updates the computeAccessibleDescription() method to handle computation of an accessible description for an element that has not been added to the document.


In this fix I have opted to use the querySelector() approach, using a polyfill of CSS.escape() to handle special characters in the element's id (e.g. see React.useId()). There may be other valid approaches that are less involved and more performant.

The fix is applied to the queryIdRefs() utility, and so also impacts other usage such as aria-owns and aria-labelledby evaluation.

changeset-bot[bot] commented 9 months ago

⚠️ No Changeset found

Latest commit: 5d373cd8ad6ebe139703ddfd2fda1058efa2be0b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR