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

[EuiComboBox] Fix keyboard selection when sortMatchesBy=startsWith #3823

Merged
merged 4 commits into from
Jul 30, 2020

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Jul 29, 2020

Summary

Fixes #3812, in which using the keyboard to select an option in EuiComboBox when sortMatchesBy=startsWith would select the wrong option.

The problem arose from the sort logic only occurring during the render function, bypassing the state store that the keyboard logic uses to track active options.

This change moves the logic to the central getMatchingOptions function, which updates component state.

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox
- [ ] Props have proper autodocs
- [ ] Added documentation

  • Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3823/

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Tested with the published docs' Sorting matches example, where the bug has been reproducible. Also tested examples without startsWith to verify those still function as expected.

Thanks for adding the test case!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3823/

@thompsongl thompsongl merged commit b4b99a0 into elastic:master Jul 30, 2020
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.

EuiComboBox broken keyboard navigation when using sortMatchesBy=startsWith
3 participants