ui icon indicating copy to clipboard operation
ui copied to clipboard

`Modal`: accept `role` as a prop

Open imageck opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe

Currently, the role of modals is hard-coded to dialog. However, ARIA also describes an alertdialog role, which is perfect for confirmation prompts or alerts that require user interaction.

Describe the solution you'd like

The Modal component should accept a role prop. If it's set to alertdialog, ensure that "keyboard and mouse interactions only operate within the dialog".

Describe alternatives you've considered

Passing role as a prop to Modal does not work because it's passed to the child div instead.

Additional context

https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/

imageck avatar Apr 24 '23 06:04 imageck

role seems to work for me in the examples:

image image

There is one small detail that it incorrectly toggles aria-modal off if you do that, which we can fix. but Are you seeing different behavior here?

jquense avatar Apr 24 '23 14:04 jquense

Apologies, @jquense. I meant to open this one for react-bootstrap. I think I mixed up the tabs. Would it be possible to move it?

Sorry!

imageck avatar Apr 25 '23 10:04 imageck