fix(EuiInputPopover): close popover on Tab, not Shift Tab#8950
Conversation
2e63a47 to
4a40697
Compare
4a40697 to
f0c2a0f
Compare
|
@weronikaolejniczak Thanks for raising the mentioned issues. I had a look at what's going on and you're right, the keyboard behavior is currently a bit weird. Additionally I'm a bit confused why 🗒️ Anyway, from what I understand these are the focus behaviors base on the two props
🐞 And concerning the keyboard navigation I saw 3 main issues:
|
|
ℹ️ @weronikaolejniczak I pushed up changes to address the issues mentioned here.
|
|
@mgadewoll LGTM 🟢 2 small things: I think we can investigate the trap focus separately. |
@weronikaolejniczak When |
|
As you wrote above:
I can imagine if it's confusing to me then it could be more confusing to the consumer. That being said, it seems like the expected behavior. |
Yeah, I'm also confused by it 😅 I still don't understand why it has duplicate FocusTraps. Probably something we could look into in the future on how to make this better. |
- ensures that tab cycling works without unexpected closing
… focus after closing the popover
- the test asserts an unexpected behavior. Checking EuiDualRange, there are no tab stops inside the popover and even if, it would be wrong to close the popover on tab
- this is a bit of a spicy decision, but it's meant to prevent issues with unexpected focus traps, as the popover doesn't have focusable content
e983fa5 to
3827ff7
Compare
💚 Build SucceededHistory
|
💚 Build Succeeded
History
|
|
@mgadewoll I reviewed the recent changes: 3827ff7 and 1ecc1c2, I believe both make sense.
|
|
@weronikaolejniczak Sorry, I hadn't posted my comment about the changes yet. You're too fast 😄 Anyway here still the comments:
ℹ️ I'm currently still waiting for the Kibana CI to finish. |
mgadewoll
left a comment
There was a problem hiding this comment.
🟢 The check in Kibana CI succeeded and the overall changes in this PR ensure a more predictable keyboard navigation for EuiInputPopover.
- `@elastic/eui`: `v106.3.0` ⏩ `v106.4.0` - `@elastic/eui-theme-borealis`: `v3.3.1` ⏩ `v3.3.2` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) ## Package updates ## [`v106.4.0`](https://github.com/elastic/eui/releases/v106.4.0) - Added prop `focusTrapProps` on `EuiModal` ([#8945](elastic/eui#8945)) **Bug fixes** - Fixed the syntax of the SCSS variable `$euiColorTransparent` to ensure a valid value ([#8966](elastic/eui#8966)) - Fixed `restrictWidth` not applying to `EuiPageHeaderContent` when only `children` are used as content ([#8965](elastic/eui#8965)) **Accessibility** - Fixed an issue where pressing Shift + Tab on the last tabbable element inside `EuiInputPopover` popover would close the popover unexpectedly ([#8950](elastic/eui#8950)) ### `@elastic/eui-theme-borealis` ## [`v3.3.2`](https://github.com/elastic/eui/releases/v3.3.2) **Bug fixes** - Fixed the syntax of the SCSS variable `$euiColorTransparent` to ensure a valid value ([#8966](elastic/eui#8966))
- `@elastic/eui`: `v106.3.0` ⏩ `v106.4.0` - `@elastic/eui-theme-borealis`: `v3.3.1` ⏩ `v3.3.2` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) ## Package updates ## [`v106.4.0`](https://github.com/elastic/eui/releases/v106.4.0) - Added prop `focusTrapProps` on `EuiModal` ([elastic#8945](elastic/eui#8945)) **Bug fixes** - Fixed the syntax of the SCSS variable `$euiColorTransparent` to ensure a valid value ([elastic#8966](elastic/eui#8966)) - Fixed `restrictWidth` not applying to `EuiPageHeaderContent` when only `children` are used as content ([elastic#8965](elastic/eui#8965)) **Accessibility** - Fixed an issue where pressing Shift + Tab on the last tabbable element inside `EuiInputPopover` popover would close the popover unexpectedly ([elastic#8950](elastic/eui#8950)) ### `@elastic/eui-theme-borealis` ## [`v3.3.2`](https://github.com/elastic/eui/releases/v3.3.2) **Bug fixes** - Fixed the syntax of the SCSS variable `$euiColorTransparent` to ensure a valid value ([elastic#8966](elastic/eui#8966))
- `@elastic/eui`: `v106.3.0` ⏩ `v106.4.0` - `@elastic/eui-theme-borealis`: `v3.3.1` ⏩ `v3.3.2` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) ## Package updates ## [`v106.4.0`](https://github.com/elastic/eui/releases/v106.4.0) - Added prop `focusTrapProps` on `EuiModal` ([elastic#8945](elastic/eui#8945)) **Bug fixes** - Fixed the syntax of the SCSS variable `$euiColorTransparent` to ensure a valid value ([elastic#8966](elastic/eui#8966)) - Fixed `restrictWidth` not applying to `EuiPageHeaderContent` when only `children` are used as content ([elastic#8965](elastic/eui#8965)) **Accessibility** - Fixed an issue where pressing Shift + Tab on the last tabbable element inside `EuiInputPopover` popover would close the popover unexpectedly ([elastic#8950](elastic/eui#8950)) ### `@elastic/eui-theme-borealis` ## [`v3.3.2`](https://github.com/elastic/eui/releases/v3.3.2) **Bug fixes** - Fixed the syntax of the SCSS variable `$euiColorTransparent` to ensure a valid value ([elastic#8966](elastic/eui#8966))

Summary
If
disableFocusTrapisfalse, regardless ofownFocus, the active item is the last tabbable item in theEuiInputPopoveroverlay and if we press Shift + Tab, the popover will close. It's expected to close only on pressing Tab because it will mean circling back to the first tabbable element. But in the other direction, it should not close.Why are we making this change?
Resolves #8949
This PR comes out of a triage, so I kept the changes to the minimum, only to address the issue that the consumer is struggling with.
That being said, the keyboard navigation in this component feels weird to me. It seems that only some combination of
disableTrapFocusandownFocusproduces the expected result. From my perspective, it's best if the keyboard navigation in this component is reworked.Escnothing happens.If you have an idea how to best handle the popover, I'm open to suggestions! Otherwise, we can address it separately whenever the time allows 😄
Screenshots
disableTrapFocus={true},ownFocus={true}disableTrapFocus={true},ownFocus={false}disableTrapFocus={false},ownFocus={true}disableTrapFocus={false},ownFocus={false}Impact to users
🟠 It's not a breaking change BUT it's a difference in component behavior which may affect some use cases detrimentally, and especially automated tests.
This change should prompt a cleanup of: elastic/kibana#230852 (comment)
QA
Specific checklist
EuiInputPopoverdoesn't close on Shift + Tab when the last interactive element is activeGeneral checklist
Checked in both light and dark modesChecked in both MacOS and Windows high contrast modes(emulate forced colors if you do not have access to a Windows machine.)Checked in mobileEdge, and FirefoxAdded documentationProps have proper autodocs (using@defaultif default values are missing) and playground togglesChecked Code Sandbox works for any docs examplesjest andcypress testsUpdated visual regression testsIf applicable, added the breaking change issue label (and filled out the breaking change checklist)If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)