-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
feat: allow multiple opaque identifiers in HTML attributes #18594
Comments
I like the API of using an array of opaque identifiers. You could make the argument that React should always join arrays passed to DOM attributes with a space, since the HTML spec defines the space as the list delimiter. This would be a breaking change though. One alternative would be iterating through every array passed to an attribute and checking that each item is an opaque identifier, but that's a lot of potentially wasted work. Maybe a special value like |
@eps1lon I believe you can safely get around this for now by using a custom class that extends |
Which also has the upside that it won't trigger Having the array shorthand is definitely nice but I think having an explicit createIdentifierList is safer long term. |
@aweary Seems like your approach only works for
|
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Bump |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Bump |
I’ve added a label to revisit so that stale bot stops trying to close this. |
Implemented with |
react version: #17322
Original: #17322 (comment)
Currently only a single value from
useOpaqueIdentifier
(unreleased) can be passed to HTML attributes. However, there are HTML attributes which support multiple ids (IDREFS) likearia-labelledby
. This can be used to implement various patterns such as:-- https://codesandbox.io/s/useopaqueidentifier-for-idrefs-ocnm4
This example is from https://www.w3.org/WAI/GL/wiki/Using_aria-labelledby_to_concatenate_a_label_from_several_text_nodes
This currently almost works but it concatenates the ids with
","
(default toString of arrays) instead of" "
.<button aria-labelledby={[opaqueIdentifier1, opaqueIdentifier1]} />
is to me the most intuitive one since we're passing a list of ids.Edit:
Removed the collapsible listbox example since that pattern has some a11y issue.
The text was updated successfully, but these errors were encountered: