-
Notifications
You must be signed in to change notification settings - Fork 829
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
[EuiContextMenuPanel] Fix popover toggle focus restoration issues and remove need for watchedItemProps
#5880
Commits on May 5, 2022
-
[misc] move componentDidUpdate fn
- move it closer to updateFocus / componentDidMount for easier context between the other two methods
Configuration menu - View commit details
-
Copy full SHA for a5be54f - Browse repository at this point
Copy the full SHA a5be54fView commit details -
[setup] Refactor popover parent finding logic
- move to separate method - create instance var - specify `initialPopover` and add `transitionType` check, as the popover doesn't re-initialize when moving between panels in the same popover, and we don't want this to re-fire unnecessarily - add E2E tests for popover behavior
Configuration menu - View commit details
-
Copy full SHA for 1e3d257 - Browse repository at this point
Copy the full SHA 1e3d257View commit details -
[fix] Add a wait condition/state for popover focus
- this makes it so EuiContextMenu doesn't call `.focus()` too early and hijack the `returnFocus` element that our focus trap dependency sets via `document.activeElement` - see elastic#5760 (comment) + Add Cypress E2E tests for popover close focus return (w/ bonus `initialFocus` regression test)
Configuration menu - View commit details
-
Copy full SHA for f6c99b8 - Browse repository at this point
Copy the full SHA f6c99b8View commit details -
[!!!] EuiContextMenuPanels with
children
are still broken and do no……t correctly return focus :( - this is because of `shouldComponentUpdate` - the `items` API updates focus less than `children`, so `children` is still updating/hijacking focus after the popover focus trap returns focus to the button
Configuration menu - View commit details
-
Copy full SHA for 6ef9342 - Browse repository at this point
Copy the full SHA 6ef9342View commit details -
[!!!] Remove
shouldComponentUpdate
logic &watchedItemProps
- replace `updateFocus` with `takeInitialFocus`, and do not continue to update/hijack focus once initial focus has been set - this removes the need to restrict how often `EuiContextMenuPanel` updates (which also requires a bunch of tedious `items` diffing that we will no longer need)
Configuration menu - View commit details
-
Copy full SHA for 1fb9b24 - Browse repository at this point
Copy the full SHA 1fb9b24View commit details -
[!!!] Move
tabbable
iteration out of focus logic and into its own m……ethod - it shouldn't be tied to the focus call anymore since the focus call no longer occurs after update, and makes more sense as a separate call + updates to logic: - do not run `tabbable` on `children` API since it won't even use the navigation - return early - use `this.backButton` instead for back button focusing, since `children` will no longer have `menuItems` - Check for a valid focusedItem - it's possible for consumers to either pass in bad indices or for `items` to update and the index to no longer exist - Add E2E tests confirming changes & new logic work as expected
Configuration menu - View commit details
-
Copy full SHA for 40dc5c4 - Browse repository at this point
Copy the full SHA 40dc5c4View commit details -
[!!!] Restore up/down key navigation behavior
- rename `incrementFocusedItemIndex` to `focusMenuItem` and change args to be a bit more human readable - instead of having the previous `updateFocus` handle up/down nav, we can simply call `.focus()` from within this method, and arrow navigation works as before - note `?.focus();` - this is important to keep as users can start mashing up/down before `tabbable` is done running and there are any menu items to focus - no specific E2E tests for this, tests should simply not be failing
Configuration menu - View commit details
-
Copy full SHA for 4b397b0 - Browse repository at this point
Copy the full SHA 4b397b0View commit details
Commits on May 6, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 1721abf - Browse repository at this point
Copy the full SHA 1721abfView commit details
Commits on May 9, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 6a7a464 - Browse repository at this point
Copy the full SHA 6a7a464View commit details -
Configuration menu - View commit details
-
Copy full SHA for f8e7a5c - Browse repository at this point
Copy the full SHA f8e7a5cView commit details