You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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".
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 theFocusTrap
wrapper that hasreturnFocus
set totrue
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.The text was updated successfully, but these errors were encountered: