Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle detached nodes for accessible descriptions #1027

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jlp-craigmorten
Copy link
Contributor

@jlp-craigmorten jlp-craigmorten commented Feb 8, 2024

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.

Copy link

changeset-bot bot commented Feb 8, 2024

⚠️ No Changeset found

Latest commit: 5d373cd

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

@jlp-craigmorten jlp-craigmorten force-pushed the fix-descriptions-for-detached-elements branch from 85f85f8 to 5d373cd Compare February 8, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

computeAccessibleDescription throws when passed a detached element
1 participant