Skip to content
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

Modal: Focus close button on open. Fallback to wrapping container div if no close button #2018

Open
jcjuett opened this issue Jun 6, 2019 · 7 comments

Comments

@jcjuett
Copy link
Contributor

jcjuett commented Jun 6, 2019

https://design-system-react-co-pr-2004.herokuapp.com/?selectedKind=SLDSModal&selectedStory=Modal%20with%20Custom%20Parent%20Node&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel

Issue: Screen readers read all lines of text as "clickable", sometimes reading multiple "clickable" before reading the content

Potential cause: Most likely a click handler is higher in the DOM (maybe the close button?) and everything inside this becomes clickable as well.

Possible solutions: Is it possible to wrap the click event in a clickable event that is not the parent for the other child elements that are reading as clickable? Please see this (older) WebAIM thread that has a long discussion of this type of issue for other potential solutions (https://webaim.org/discussion/mail_thread?thread=7693)

@interactivellama
Copy link
Contributor

Is this a side-effect of the initially focused element on Modal loading is the invisible container element that then reads all of the Modal contents?

@jcjuett
Copy link
Contributor Author

jcjuett commented Jun 7, 2019

It may be. I suspect the screen reader identifies the focus and then reads all of the content as interactive. What do you think?

@interactivellama
Copy link
Contributor

All the content is grouped in a tabIndex=0 div.

@jcjuett
Copy link
Contributor Author

jcjuett commented Jun 7, 2019

Yep--that's the problem I think. How can we move the content out from this div? Or can we?

@interactivellama
Copy link
Contributor

interactivellama commented Jun 7, 2019

We could remove the tabIndex of the div and focus on the close button if the close button is present, but if it's not there, then we will have to fallback to this div hack. I think close buttons are present on most modals at our company, so I am not worried about the edge case.

@jcjuett
Copy link
Contributor Author

jcjuett commented Jun 7, 2019

Yes, our modals do have close buttons. I don't know of any that don't. So, could we move focus to the close button instead of the entire div contents?

@interactivellama
Copy link
Contributor

Yes. I agree.

@interactivellama interactivellama changed the title Modal: headings and content are read as "clickable" by screen reader Modal: Focus close button on open. Fallback to wrapping container div if no close button Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants