Closed dualcyclone closed 3 years ago
Did you mean to post this in the react-bootstrap project?
If you're using react-bootstrap, you can pass aria-labelledby
to the Modal, which passes it to the role="dialog"
element
Did you mean to post this in the react-bootstrap project?
The example demonstrates this behaviour on react-bootstrap/Modal
If you're using react-bootstrap, you can pass
aria-labelledby
to the Modal, which passes it to therole="dialog"
element
Yes, I should be able to use aria-label
to label the model directly, if I do not have a DOM element that contains a label.
If it's possible to use aria-labelledby
, it should also accept aria-label
As noted in this comment:
It's expected that you will add the
aria-labelledby
or other form of labelling.
However it seems it does not accept any other form of labelling
Ok sounds like you are not using react-overlays
directly. The other comment by @jquense was in regards to using the Modal from react-overlays
which does forward all props to the underlying element. I think there's some confusion here because this issue is posted in react-overlays
project rather than react-bootstrap
Apologies, I'll move the issue there
Describe the bug
Related to https://github.com/react-bootstrap/react-overlays/issues/964
Adding any
aria
attributes to theModal
adds these to the child DOM element, which means the main parent element still does not have an accessible label.To Reproduce
Create a
Modal
and addaria-label="test"
to it:Observe that the
aria-label
added does not get added to the element withrole="dialog"
, but instead onto its first child.Reproducible Example
Minimal example by using CodeSandbox.
Expected behavior
The main element with
role="dialog"
should have thearia
attributes added to it.Additional context
MDN - ARIA: dialog role