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

[fixed] check if element exists before focusing in scopeTab helper #689

Merged
merged 2 commits into from
Sep 27, 2018

Conversation

DarudeGarystorm
Copy link

Fixes #687

Changes proposed:

  • check if element is undefined before focusing it

Acceptance Checklist:

  • The commit message follows the guidelines in CONTRIBUTING.md.
  • Documentation (README.md) and examples have been updated as needed.
  • If this is a code change, a spec testing the functionality has been added.
  • If the commit message has [changed] or [removed], there is an upgrade path above.

@coveralls
Copy link

coveralls commented Sep 26, 2018

Coverage Status

Coverage decreased (-1.006%) to 86.697% when pulling 0318e8f on DarudeGarystorm:fix/687-scopeTab into 2a70831 on reactjs:master.

@@ -62,6 +62,10 @@ export default function scopeTab(node, event) {
x += shiftKey ? -1 : 1;
}

// If the tabbable element does not exist,
// let the browser control the focus
if (typeof tabbable[x] === "undefined") return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe, we actually need to focus the first element in this case, otherwise I suspect it can miss radios inputs.

Copy link
Author

Choose a reason for hiding this comment

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

Updated to focus head/tail based on shiftKey

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch!

@diasbruno diasbruno merged commit 1b561fc into reactjs:master Sep 27, 2018
@diasbruno
Copy link
Collaborator

Thanks you, @DarudeGarystorm!

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