-
Notifications
You must be signed in to change notification settings - Fork 79
Improve a11y by using button with role switch #26
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
Conversation
As for [mozilla switch guidelines](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_switch_role) Plus I switched `span` for `button` to get support for `Enter` and `Space` keys out of the box (now the browser will take care about it and that's why I deleted the test, cause enzyme doesn't fire `onClick` on such keypresses, but the browsers will do)
@zombieJ , are you busy or you're waiting for me to fix the coverage? Cause right now I don't why the coverage is decreased. I've deleted a test, but also deleted the code the test was testing. coveralls report doesn't help either |
I'm OK with this. |
expect(switcher.state().checked).toBe(true); | ||
switcher.simulate('keydown', { keyCode: 13 }); | ||
expect(switcher.state().checked).toBe(false); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enzyme doesn't fire onClick on such keypresses, but the browsers will call onClick
because it's button
Plus, if we'll try to test such behavior we will be actually testing a11y specification, which i think we shouldn't do
cool |
@afc163 answered in the issue |
As for mozilla switch guidelines
Plus I switched
span
forbutton
to get support forEnter
andSpace
keys out of the box (now the browser will take care about it and that's why I deleted the test, cause enzyme doesn't fireonClick
on such keypresses, but the browsers will do)Fixes #22