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

[EuiDataGrid][A11y] Ensure focus is returned to trigger after fullscreen is closed #8485

Closed
mgadewoll opened this issue Mar 21, 2025 · 1 comment

Comments

@mgadewoll
Copy link
Contributor

Description

Relates to elastic/kibana#214131

When closing the fullscreen view for EuiDataGrid the focus should always be returned to the trigger element. This is currently handled by the FocusTrap wrapper that has returnFocus set to true by default.

This works as expected on EUI side (docs and Storybook) but does not work as expected in Kibana Discover. The focus is lost/moved on close (next focusable item is the skip link).

Screen.Recording.2025-03-21.at.12.08.20.mov

Suggested next steps

We should investigate why the focus is lost in Discover and try to create a reproducible state on EUI side to determine if it's something we can generally fix from EUI side or it's a consumer specific issue.
There might be other focus events intercepting on consumer side, timing conflicts or re-rendering causing the focus to be lost.

This might be "stranded focus" (returned but lost) and we could consider checking for such stranded focus and returning it (see a similar example for popover) as it might be an already "known issue" with returnFocus)

We could also check if returning the focus directly as part of the fullscreen functionality (code) works more reliably than using the returnFocus on the focus trap.

@mgadewoll mgadewoll added accessibility data grid ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible labels Mar 21, 2025
@mgadewoll mgadewoll self-assigned this Mar 27, 2025
@mgadewoll
Copy link
Contributor Author

mgadewoll commented Apr 3, 2025

The underlying issue seems to be on consumer side. (see my comment here and here)
In short: Kibana uses a EuiScreenReaderOnly component for announcements, e.g. for announcing the page title/info. This element is set to be focused on text change and in the use case of EuiDataGrid on Discover the screenreader-only element is mounted/unmounted with the header component depending on the fullscreen mode state. That results in it receiving focus on mount when the fullscreen mode is closed which then as a result steals the focus from the toggle button.

TL;DR EuiDataGrid as is works as expected, the focus is not stranded, it is "stolen".

@mgadewoll mgadewoll removed the ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible label Apr 4, 2025
@mgadewoll mgadewoll closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant