Popover: label missing from Popover.Root #2443
Labels
Package: react/popover
Topic: Accessibility
This issue has to do with accessibility
Type: Enhancement
Small enhancement to existing primitive/feature
Bug report
Current Behavior
The
Popover
implements thedialog
pattern, but is missing one thing, thelabel
on the dialog element itself.The pattern states the following:
But this does not seem to be implemented.
Expected behavior
There's an API which I can use the set a
label
for the element that hasrole="dialog"
on it.Reproducible example
I did not create a reproduction as you can just go to the docs page, open the popover, inspect the element and see that there's no
aria-label
oraria-labelledby
attribute on it.Suggested solution
I have two suggestions in mind.
Popover.Header
element, that people can use to render whatever heading they want for theirPopover
and internally we can link to content of this element to therole="dialog"
element by adding anid
to it and usingaria-labelledby
.label
prop that accepts astring
that we can put into thearia-label
attribute. This solution could be useful when the popover does not have a clear title, but you still want to provide one for assistive technology users.I suppose the first solution is more radix-y, but both could be implemented and the
label
prop can be an escape hatch.If we can figure out what road to go down on, I'm happy to submit a PR with the preferred solution.
Your environment
It happens on every environment
The text was updated successfully, but these errors were encountered: