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

Enable usage of tab to focus next element after selection #24

Merged
merged 1 commit into from
Mar 7, 2019

Conversation

jimutt
Copy link

@jimutt jimutt commented Mar 5, 2019

With the current behavior I find that it's impossible to escape the input field using keyboard navigation only. This is because of e.preventDefault() in the handler for TAB and ENTER key events.

In this PR a check is introduced to determine if the suggestion list is open or not. If it's open, TAB can be used to select an item in the list. If it's not open, the standard browser behavior is used to move focus to the next focusable element on the page.

I needed to implement this quick-fix at work in order to enable full keyboard navigation on the page where the suggestion component will be used. Feel free to decline the PR if it introduces any unwanted behavior which does not align well with your idea of how it's supposed to work.

@andrewharvey
Copy link
Collaborator

This sounds fair to me.

Copy link
Collaborator

@andrewharvey andrewharvey left a comment

Choose a reason for hiding this comment

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

I just tested this out, looks good to me.

@tristen tristen merged commit 5cbd4f4 into tristen:gh-pages Mar 7, 2019
@tristen
Copy link
Owner

tristen commented Mar 7, 2019

👍

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.

3 participants