From d3284d5430367039f7c21c549f8add1dc57d5cf6 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Wed, 4 Nov 2020 12:02:41 -0700 Subject: [PATCH] [EuiPopover] Fix popover returning focus to correct element (#4071) * Move onclickoutside / onescape handling to focus-lock lib itself * Get popover focus return functioning * Fix lint issues & snapshots, re-enable clickOutsideDisables prop for EuiFocusTrap * fix popover re-toggling when clicking its anchor * Re-enable popover outside click and escape key detection when ownFocus is false * Only call popover's closePopover callback when it is open * Don't scroll back to a popover anchor when the popover closes * Address unintentional changes to flyouts & color picker * changelog * revert changes to popover example, which had been made to augment testing * Fix flyout's snapshot tests --- CHANGELOG.md | 2 + .../in_memory_table.test.tsx.snap | 1 - .../collapsible_nav.test.tsx.snap | 566 +++++++++--------- src/components/color_picker/color_picker.tsx | 4 + .../__snapshots__/data_grid.test.tsx.snap | 360 ++++++----- .../flyout/__snapshots__/flyout.test.tsx.snap | 236 ++++---- src/components/flyout/flyout.test.tsx | 28 +- src/components/flyout/flyout.tsx | 2 +- src/components/focus_trap/focus_trap.test.tsx | 8 +- src/components/focus_trap/focus_trap.tsx | 99 +-- .../__snapshots__/super_select.test.tsx.snap | 426 +++++++------ .../__snapshots__/popover.test.tsx.snap | 516 ++++++++-------- src/components/popover/popover.tsx | 71 ++- 13 files changed, 1132 insertions(+), 1187 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e9451cd744..a817cbdc412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ **Bug fixes** +- Fixed focus trap + `EuiPopover` bug which prevented the anchor from receiving focus when the popover closes ([#4071](https://github.com/elastic/eui/pull/4071)) +- Fixed focus trap error & performance impact when one focus trap is deactivated and another becomes enabled ([#4071](https://github.com/elastic/eui/pull/4071)) - Fixed a condition in `EuiInMemoryTable` to avoid mistaken assignment of `sortName` ([#4138](https://github.com/elastic/eui/pull/4138)) ## [`30.2.0`](https://github.com/elastic/eui/tree/v30.2.0) diff --git a/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap b/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap index 06c25f28ce6..d5a8f674145 100644 --- a/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap +++ b/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap @@ -359,7 +359,6 @@ exports[`EuiInMemoryTable behavior pagination 1`] = ` panelPaddingSize="none" >