-
Notifications
You must be signed in to change notification settings - Fork 12
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
Don't use tabindex to remove elements from focus #893
Comments
Also Edge behaves like IE11 for tabindex so the workaround is needed for both browsers. |
I think the best way forward is to use the data attribute to flag that elements are not focusable. https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes |
This is a little tricky because now we can only set the tabindex when overriding the default browser behavior for any given element. |
Above commit should handle this. tabindex is now only used when we are overriding default browser behavior. So input elements like |
@jessegreenberg and I talked, and he answered a bit of my confusion with this issue, and caught me up! Review:
|
All good ideas @zepumph, done in the above commits. Can you please check? |
@mbarlow12 said that keyboard navigation is mostly broken in Safari, and there is also strange zooming in VO. This issue could be a cause since it changed how we notify the browser which elements we want to be focusable. We should make sure that we haven't broken things on all browsers with this change. |
@mbarlow12 showed me what was happening on his machine. The keyboard navigation issue was in user settings because Mac disables keybaord nav by default for some reason. The zooming issue was still happening, but I doubt it is related to this issue. Ill make an issue to check on the zooming further. |
Review is great! I like the tests. Thanks. Ready to close? |
I think so, thanks for reviewing! |
From phetsims/resistance-in-a-wire#189.
tabindex="-1" is being used to remove all elements from the focus order (even those that are not focusable by default). This is necessary because IE11 by default gives ALL HTML elements a tabindex of "0", including list items, paragraphs, everything. See phetsims/john-travoltage#206.
We are counting on focusable elements having tabindex >= 0 in AccessibilityUtil.isElementFocusable, so as an easy workaround for IE11 we are setting tabindex of all elements in the PDOM to be -1 when not focusable.
But setting tabindex="-1" is now interfering with JAWS reading in Chrome. For some reason this causes lists (and probably other things) to be read twice. For instance, this list
is read as
"resistance R is 0.667 ohms, resistivity rho is 0.50 ohm centimeters, length L is 10.00 centimeters, area A is 7.50 centimeters squared. List with four items. Bullet, resistance R is 0.667 ohms. Bullet, resistivity rho is 0.50 ohm centimeters. Bullet, length L is 10.00 cm, bullet area A is 7.50 centimeters squared."
As we are transitioning to support Chrome instead of FF, this needs to be fixed. We need a different way to flag elements as not focusable for IE11, while not interfering with how Chrome reads things with JAWS.
The text was updated successfully, but these errors were encountered: