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

Make elements keyboard accessible #83

Merged
merged 1 commit into from
May 27, 2017

Conversation

geramirez
Copy link
Contributor

This is a work in progress, I just wanted to get some feedback if the changes are OK. Then I will add tests and clean up the code.

@paranoidjk
Copy link
Member

LGTM. but should the tabIndex be different?

@benjycui benjycui changed the title Make elements keyboard accessible [WIP] Make elements keyboard accessible May 25, 2017
@geramirez
Copy link
Contributor Author

geramirez commented May 25, 2017

A tabindex of 0 makes the element focusable using the keyboard. It's best to use '0' unless you want to explicitly change the natural html order.

Ok, we've made the final changes. As for tests, it looks like they were failing with version 6.x of rc-tools, but will pass with 5.x. We did not revert the version in this commit, but that might be necessary for the tests to pass.

If you're interested we can update the tests to use the enzyme library. Let us know.

@paranoidjk
Copy link
Member

rc-tools 6.x have moved all test command to a new package called rc-test,you can just use rc-test to replace the relative test command,then ci should be no problem any more.

But if you are willing to refactor test with jest and enzyme,that would be great too. You can see https://github.com/react-component/slider test code as a example.

@geramirez
Copy link
Contributor Author

@paranoidjk it appears that CI was broken before this PR. We checked that we did not create new errors by running the tests before and after this feature update.

Would this be ok to merge at this point?

@@ -190,6 +190,12 @@ class Pagination extends React.Component {
return this.state.current < this._calcPage();
}

_runIfEnter(event, callback) {
if (event.keyCode === 'Enter') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use event .key === 'Enter' or event.charCode === 13, see https://facebook.github.io/react/docs/events.html#keyboard-events

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the update should be ready.

@paranoidjk
Copy link
Member

@geramirez As i mentioned earlier, just follow this react-component/checkbox@cd7c340 to fix the ci.

Signed-off-by: Gabriel Ramirez <[email protected]>
Signed-off-by: Patrick Oyarzun <[email protected]>
Signed-off-by: Gabriel Ramirez <[email protected]>
Signed-off-by: Patrick Oyarzun <[email protected]>
@geramirez
Copy link
Contributor Author

Ok, @paranoidjk the build is fixed.
We also added rc-test and fixed the test that was broken

@paranoidjk paranoidjk changed the title [WIP] Make elements keyboard accessible Make elements keyboard accessible May 27, 2017
@paranoidjk paranoidjk merged commit 04d8f8a into react-component:master May 27, 2017
@paranoidjk paranoidjk mentioned this pull request May 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants