react-accessible-modal
react-accessible-modal copied to clipboard
Review accessibility of the modal
Specific things I'm not sure of or I think are wrong:
- Why does it
stopPropagationon click on the wrapper around the content? - Is it really a good practice to set an
aria-labelon the modal content? - Why is the close button a
div? Could we use abuttoninstead? - There should be a screen-reader only textual label in the close button, and the "X" should be
aria-role="presentation" - The
modal__overlayshould probably bearia-hidden.
Some initial comments:
- Guess there are several ways to handle the close button. Add the
aria-labelto trigger and applyaria-hiddenon span around "X". Or have two spans, one with accessibly hidden class and actual wordsClose modal windowand the "X" withrole="presentation"oraria-hidden. Several ways to do, not sure what's best. Just need to pick one and apply it :) - Close button needs an
aria-controlsattribute connected to anidapplied to the content dialogue - The
modal__overlaydoesn't actually have any content so I predict it wouldn't get interpreted as anything anyway. But we could always addaria-hiddento be safe - No specific reason why the demo close button is a div, this is perhaps legacy. It has a
role="button"andtabindexset appropriately so it's not technically wrong. Can just be avoided by using a button 😄 - In general, I have concerns with the way the actual modal content gets added and deleted. Not sure how the accessibility api gets updated if we add content to the DOM using js. May want to consider rendering the content by default and simply show/hiding it a bit more? I guess you react experts will maybe know more about this than me so it's just food for thought.