-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(TableToolbarSearch): support back-tab #3836
fix(TableToolbarSearch): support back-tab #3836
Conversation
This change fixes the issue with `<TableToolbarSearch>` that happens when the `<input>` in it has focus and user performs back-tab gesture (Shift-Tab key). In such scenario (in before-change version), the root element of `<TableToolbarSearch>` (`<div class="bx--toolbar-search-container-expandable">`) gets focus given it has `tabindex="0"`, and the `onFocus()` handler of the element attempts to send focus back to the `<input>` no matter what. This change also fixes the following found in the debugging effort: * An issue where `id` of `<Search>` in `<TableToolbarSearch>` is regenerated for every render * Issues focus on `<input>` happening: * For every render, regardless of change in expanded state * Even for controlled change in expanded state (without user gesture) Fixes carbon-design-system#3762.
Deploy preview for the-carbon-components ready! Built with commit bc0ab54 https://deploy-preview-3836--the-carbon-components.netlify.com |
Deploy preview for carbon-elements ready! Built with commit bc0ab54 |
Deploy preview for carbon-components-react ready! Built with commit bc0ab54 https://deploy-preview-3836--carbon-components-react.netlify.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 🎉 LGTM
This change fixes the issue with
<TableToolbarSearch>
that happens when the<input>
in it has focus and user performs back-tab gesture (Shift-Tab key).In such scenario (in before-change version), the root element of
<TableToolbarSearch>
(<div class="bx--toolbar-search-container-expandable">
) gets focus given it hastabindex="0"
, and theonFocus()
handler of the element attempts to send focus back to the<input>
no matter what.This change also fixes the following found in the debugging effort:
id
of<Search>
in<TableToolbarSearch>
is regenerated for every render<input>
happening:Fixes #3762.
Changelog
New
<input>
code from runningChanged
tabindex
of the outer container of<TableToolbarSearch>
, so it's focusable only when it's collapsedRemoved
<TableToolbarSearch>
given the<input>
in it handles thatTesting / Reviewing
Testing should make sure
<TableToolbarSearch>
is not broken.