Skip to content

Conversation

@devanshj
Copy link
Contributor

@devanshj devanshj commented Sep 6, 2019

Motivation

Currently there is no way to exit the tab trap with a keyboard. If you want to focus out of the editor you'll have to use a mouse to click outside which is bad for accessibility. I'm no expert in accessibility, but you can read more here.

To fix this the PR allows the user to exit the tab trap by pressing the escape key which was suggested in the issue.

Test plan

You can test it in the example page, while the editor is focused press escape and then press tab and the focus should move to the next element. Since editor is last element in the example the focus will go to probably the url bar, so instead append a temporary link after editor to check if that is focused.

Fixes chakra-ui #5
chakra-ui docs uses react-live which uses react-simple-code-editor.

Allow users to escape the tab trap using escape key
@devanshj
Copy link
Contributor Author

@satya164 Can we merge this? It's quite a low hanging fruit, won't take more than 5 minutes to review.

Copy link
Collaborator

@satya164 satya164 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@satya164 satya164 changed the title Fix keyboard trap: allow users to escape the tab trap using escape key fix: allow users to escape the tab trap using escape Sep 30, 2019
@satya164 satya164 merged commit 6175634 into react-simple-code-editor:master Sep 30, 2019
@devanshj
Copy link
Contributor Author

You're welcome!

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.

Code editor leading to keyboard trap

2 participants