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

fix(tool_tip): stop propagation on escape key down #8140

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

weronikaolejniczak
Copy link
Contributor

@weronikaolejniczak weronikaolejniczak commented Nov 14, 2024

Summary

When we have EuiIconTip (consequently, EuiTooltip) within EuiFlyout and with the tooltip open we click "Escape" key, the flyout gets closed. The reason is, the escape keydown event is propagated from the tooltip and captured by the flyout as its parent. Simple event.stopPropagation() inside EuiTooltip seemed to do the trick.

closes #8130

QA

Test path:

  1. Run Storybook locally: yarn storybook.
  2. Find the component EuiFlyout.
  3. Close the flyout with the escape key.
  4. Change the EuiFlyoutBody to contain a EuiToolTip as children.
  5. Focus the tooltip and close it with the escape key. The flyout should not close, the tooltip - yes.
  6. Focus out of the tooltip and close the flyout with the escape key.
Screen.Recording.2024-11-14.at.15.05.38.mov

Manual QA of other focus-trap elements

EuiModal

Screen.Recording.2024-11-22.at.19.44.54.mov

EuiPopover

Screen.Recording.2024-11-22.at.19.47.32.mov

EuiDataGrid fullscreen

Screen.Recording.2024-11-22.at.19.49.26.mov

General checklist

  • Browser QA
    • Checked in both light and dark modes (not applicable)
    • Checked in mobile (not applicable)
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
    • Added documentation (not applicable)
    • Props have proper autodocs (using @default if default values are missing) and playground toggles (not applicable)
    • Checked Code Sandbox works for any docs examples (not applicable)
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer 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)

@weronikaolejniczak weronikaolejniczak changed the title [WIP] fix(flyout): close flyout only on non-propagated escape fix(flyout): close flyout only on non-propagated escape Nov 18, 2024
@weronikaolejniczak weronikaolejniczak changed the title fix(flyout): close flyout only on non-propagated escape fix(tool_tip): stop propagation on escape key down Nov 18, 2024
@weronikaolejniczak weronikaolejniczak force-pushed the fix/8130-eui-flyout-tooltip-esc branch 7 times, most recently from a4d77c5 to 3bcd2b5 Compare November 22, 2024 09:49
@weronikaolejniczak weronikaolejniczak marked this pull request as ready for review November 22, 2024 13:02
@weronikaolejniczak weronikaolejniczak requested a review from a team as a code owner November 22, 2024 13:02
Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

This LGTM (awesome work with the E2E test!) - but I'll defer to @mgadewoll for any final comments since I believe she solved a similar bug/issue recently. My only other thought is we might also want to either QA or write a test for the following other focus trap components:

  • modals
  • popovers
  • various fullscreen modes (EuiDataGrid fullscreen, EuiImage fullscreen, EuiCodeBlock fullscreen(?) - not sure that last one can even have a tooltip)

@weronikaolejniczak
Copy link
Contributor Author

Thanks for the great suggestion, Cee! 🌈 I focused so much on fixing that one test case I forgot about the other overlay elements that might suffer the same issue.

I updated the description with the screen recordings from the manual QA. EuiImage and EuiCodeBlock don't seem to allow for additional children in the fullscreen mode.

One doubt I have - is the stopPropagation in the tooltip the only point-of-failure for all these cases? If so, is it okay that we're adding (rather) expensive Cypress tests for each affected component? We could switch to RTL but then we need to remember it works with a dumb-downed DOM implementation, maybe not the best fit for asserting keyboard navigation and overlay elements.

If we agree to add the automated tests after all, I'll work on that first thing Monday!

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@cee-chen
Copy link
Member

I'm fine with skipping the automated Cypress tests for each focus trap use case - flyouts are likely our biggest use-case in any case. EuiDataGrid might be the second most likely use-case in production. I'm also fine with manual QA only for the cases I noted, I just want to make sure someone tested it :) It might also be nice for future devs to add an inline comment next to the flyout Cypress test noting which other edge cases to manually QA.

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.

[EuiFlyout] Pressing ESC on a tooltip element inside the EuiFlyout should not close the flyout.
4 participants