From 69790d7faba06143a300b33ea2a53c93d9485af8 Mon Sep 17 00:00:00 2001 From: miukimiu Date: Wed, 4 Nov 2020 16:08:51 +0000 Subject: [PATCH 1/8] Defaulting to ownfocus --- src-docs/src/views/popover/popover.js | 1 - .../views/popover/popover_anchor_position.js | 12 -- src-docs/src/views/popover/popover_block.js | 1 - .../src/views/popover/popover_container.js | 1 - src-docs/src/views/popover/popover_example.js | 9 +- src-docs/src/views/popover/popover_fixed.js | 1 - .../popover/popover_htmlelement_anchor.js | 1 - .../views/popover/popover_panel_class_name.js | 1 - .../src/views/popover/popover_with_title.js | 3 - .../popover/popover_with_title_padding.js | 6 - src-docs/src/views/popover/trap_focus.js | 1 + .../collapsed_item_actions.test.tsx.snap | 2 +- .../in_memory_table.test.tsx.snap | 2 +- .../__snapshots__/popover.test.tsx.snap | 152 +++++++++++++----- src/components/popover/popover.tsx | 2 +- 15 files changed, 117 insertions(+), 78 deletions(-) diff --git a/src-docs/src/views/popover/popover.js b/src-docs/src/views/popover/popover.js index ba69af62976..b6b0bbd2a9e 100644 --- a/src-docs/src/views/popover/popover.js +++ b/src-docs/src/views/popover/popover.js @@ -17,7 +17,6 @@ export default () => { return ( diff --git a/src-docs/src/views/popover/popover_anchor_position.js b/src-docs/src/views/popover/popover_anchor_position.js index 526c442016e..4942c58ffeb 100644 --- a/src-docs/src/views/popover/popover_anchor_position.js +++ b/src-docs/src/views/popover/popover_anchor_position.js @@ -86,7 +86,6 @@ export default () => { { { { { { { { { { { { { return ( { return ( @@ -67,6 +66,7 @@ const popOverSnippet = ``; const trapFocusSnippet = ` @@ -74,7 +74,6 @@ const trapFocusSnippet = ``; const popoverAnchorSnippet = ``; const popoverWithTitleSnippet = ` @@ -93,7 +91,6 @@ const popoverWithTitleSnippet = ``; const popoverPanelClassNameSnippet = ``; const popoverWithTitlePaddingSnippet = ``; const popoverContainerSnippet = ``; const popoverFixedSnippet = ``; const popoverBlockSnippet = ` { Toggle example {isExampleShown && ( { return ( diff --git a/src-docs/src/views/popover/popover_panel_class_name.js b/src-docs/src/views/popover/popover_panel_class_name.js index b2595b1f8b8..b5906d7cefd 100644 --- a/src-docs/src/views/popover/popover_panel_class_name.js +++ b/src-docs/src/views/popover/popover_panel_class_name.js @@ -11,7 +11,6 @@ export default () => { return ( { { { { { { { { { { button={button} isOpen={isPopoverOpen} closePopover={closePopover} + ownFocus={false} initialFocus="[id=asdf2]"> 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..8b8b4d4c659 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 @@ -355,7 +355,7 @@ exports[`EuiInMemoryTable behavior pagination 1`] = ` display="inlineBlock" hasArrow={true} isOpen={false} - ownFocus={false} + ownFocus={true} panelPaddingSize="none" >
@@ -146,34 +155,43 @@ exports[`EuiPopover props buffer 1`] = `
@@ -221,34 +239,43 @@ exports[`EuiPopover props isOpen renders true 1`] = `
@@ -271,34 +298,43 @@ exports[`EuiPopover props offset with arrow 1`] = `
@@ -321,33 +357,42 @@ exports[`EuiPopover props offset without arrow 1`] = `
@@ -369,34 +414,43 @@ exports[`EuiPopover props ownFocus defaults to false 1`] = `
@@ -476,34 +530,43 @@ exports[`EuiPopover props panelClassName is rendered 1`] = `
@@ -525,34 +588,43 @@ exports[`EuiPopover props panelPaddingSize is rendered 1`] = `
diff --git a/src/components/popover/popover.tsx b/src/components/popover/popover.tsx index 25e8733e92b..479908514e8 100644 --- a/src/components/popover/popover.tsx +++ b/src/components/popover/popover.tsx @@ -297,7 +297,7 @@ type PropsWithDefaults = Props & { export class EuiPopover extends Component { static defaultProps: Partial = { isOpen: false, - ownFocus: false, + ownFocus: true, anchorPosition: 'downCenter', panelPaddingSize: 'm', hasArrow: true, From 8fded20b422d5f61e6b857b05990348a35fd1afb Mon Sep 17 00:00:00 2001 From: miukimiu Date: Thu, 5 Nov 2020 16:17:24 +0000 Subject: [PATCH 2/8] Defaulting ownFocus to true --- src-docs/src/views/color_picker/containers.js | 1 - src-docs/src/views/combo_box/containers.js | 1 - .../src/views/datagrid/control_columns.js | 6 +- src-docs/src/views/datagrid/datagrid.js | 3 +- src-docs/src/views/expression/columns.js | 2 - src-docs/src/views/expression/expression.js | 2 - .../src/views/filter_group/filter_group.js | 1 - .../views/filter_group/filter_group_multi.js | 1 - .../src/views/form_layouts/inline_popover.js | 2 - src-docs/src/views/header/header.js | 3 - src-docs/src/views/header/header_alert.js | 1 - .../views/header/header_elastic_pattern.js | 3 - .../views/popover/popover_anchor_position.js | 12 -- src-docs/src/views/popover/popover_block.js | 1 - .../src/views/popover/popover_container.js | 1 - src-docs/src/views/popover/popover_example.js | 12 +- src-docs/src/views/popover/popover_fixed.js | 1 - .../popover/popover_htmlelement_anchor.js | 1 - .../views/popover/popover_panel_class_name.js | 1 - .../src/views/popover/popover_with_title.js | 3 - .../popover/popover_with_title_padding.js | 6 - .../collapsed_item_actions.test.tsx.snap | 2 +- .../in_memory_table.test.tsx.snap | 105 ++++++++---------- src/components/datagrid/column_selector.tsx | 1 - src/components/datagrid/column_sorting.tsx | 2 - .../datagrid/data_grid_cell_popover.tsx | 1 - src/components/datagrid/style_selector.tsx | 1 - .../quick_select_popover.tsx | 3 +- .../header/header_links/header_links.tsx | 1 - .../__snapshots__/popover.test.tsx.snap | 77 +++++++++++-- src/components/popover/popover.test.tsx | 3 +- src/components/popover/popover.tsx | 2 +- .../filters/field_value_selection_filter.tsx | 1 - .../table/mobile/table_sort_mobile.tsx | 1 - 34 files changed, 128 insertions(+), 136 deletions(-) diff --git a/src-docs/src/views/color_picker/containers.js b/src-docs/src/views/color_picker/containers.js index 7e70312e2bc..eb654f4933b 100644 --- a/src-docs/src/views/color_picker/containers.js +++ b/src-docs/src/views/color_picker/containers.js @@ -98,7 +98,6 @@ export default () => { diff --git a/src-docs/src/views/combo_box/containers.js b/src-docs/src/views/combo_box/containers.js index de12e482761..135bc3b9845 100644 --- a/src-docs/src/views/combo_box/containers.js +++ b/src-docs/src/views/combo_box/containers.js @@ -146,7 +146,6 @@ export default () => { diff --git a/src-docs/src/views/datagrid/control_columns.js b/src-docs/src/views/datagrid/control_columns.js index 46efe053ece..2128386fc8b 100644 --- a/src-docs/src/views/datagrid/control_columns.js +++ b/src-docs/src/views/datagrid/control_columns.js @@ -95,8 +95,7 @@ const SelectionButton = () => { selected } - closePopover={() => setIsPopoverOpen(false)} - ownFocus={true}> + closePopover={() => setIsPopoverOpen(false)}> {selectedRows.size} {selectedRows.size > 1 ? 'items' : 'item'} @@ -265,8 +264,7 @@ const trailingControlColumns = [ onClick={() => setIsPopoverOpen(!isPopoverOpen)} /> } - closePopover={() => setIsPopoverOpen(false)} - ownFocus={true}> + closePopover={() => setIsPopoverOpen(false)}> Actions
- -
+ + + +
- +
diff --git a/src/components/datagrid/column_selector.tsx b/src/components/datagrid/column_selector.tsx index 1c8b61223ac..f28e62cccd0 100644 --- a/src/components/datagrid/column_selector.tsx +++ b/src/components/datagrid/column_selector.tsx @@ -150,7 +150,6 @@ export const useColumnSelector = ( isOpen={isOpen} closePopover={() => setIsOpen(false)} anchorPosition="downLeft" - ownFocus panelPaddingSize="s" panelClassName="euiDataGridColumnSelectorPopover" button={ diff --git a/src/components/datagrid/column_sorting.tsx b/src/components/datagrid/column_sorting.tsx index 1710e29f6a4..8e419b38403 100644 --- a/src/components/datagrid/column_sorting.tsx +++ b/src/components/datagrid/column_sorting.tsx @@ -141,7 +141,6 @@ export const useColumnSorting = ( isOpen={isOpen} closePopover={() => setIsOpen(false)} anchorPosition="downLeft" - ownFocus panelPaddingSize="s" panelClassName="euiDataGridColumnSortingPopover" button={ @@ -212,7 +211,6 @@ export const useColumnSorting = ( isOpen={avilableColumnsisOpen} closePopover={() => setAvailableColumnsIsOpen(false)} anchorPosition="downLeft" - ownFocus panelPaddingSize="s" button={ setIsOpen(false)} anchorPosition="downCenter" - ownFocus panelPaddingSize="s" panelClassName="euiDataGridColumnSelectorPopover" button={ diff --git a/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx b/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx index 09ba63afd5a..4d8e97f2a72 100644 --- a/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx +++ b/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx @@ -187,8 +187,7 @@ export class EuiQuickSelectPopover extends Component< isOpen={isOpen} closePopover={this.closePopover} anchorPosition="downLeft" - anchorClassName="euiQuickSelectPopover__anchor" - ownFocus> + anchorClassName="euiQuickSelectPopover__anchor">
diff --git a/src/components/header/header_links/header_links.tsx b/src/components/header/header_links/header_links.tsx index 6899c3fa391..39fab32d0a1 100644 --- a/src/components/header/header_links/header_links.tsx +++ b/src/components/header/header_links/header_links.tsx @@ -134,7 +134,6 @@ export const EuiHeaderLinks: FunctionComponent = ({ @@ -154,16 +163,25 @@ exports[`EuiPopover props buffer 1`] = ` data-focus-lock-disabled="disabled" >