Skip to content

Commit

Permalink
[EuiPopover] Default to ownFocus (elastic#4228)
Browse files Browse the repository at this point in the history
* Defaulting to ownfocus

* Defaulting ownFocus to true

* Trap focus example

* Removing ownFocus prop

* Adding CL

* Test for default ownFocus and  tour step popover ownFocus changed to false.

* Update src-docs/src/views/popover/popover_example.js

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>

* Fixing tests

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
  • Loading branch information
3 people authored and Michail Yasonik committed Feb 18, 2021
1 parent db3ddc1 commit df90c3b
Show file tree
Hide file tree
Showing 38 changed files with 155 additions and 153 deletions.
1 change: 0 additions & 1 deletion src-docs/src/views/color_picker/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export default () => {
<EuiFormRow label="Unruly focus management">
<EuiPopover
id="popover"
ownFocus={true}
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/combo_box/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export default () => {

<EuiPopover
id="popover"
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand Down
6 changes: 2 additions & 4 deletions src-docs/src/views/datagrid/control_columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ const SelectionButton = () => {
selected
</EuiButtonEmpty>
}
closePopover={() => setIsPopoverOpen(false)}
ownFocus={true}>
closePopover={() => setIsPopoverOpen(false)}>
<EuiPopoverTitle>
{selectedRows.size} {selectedRows.size > 1 ? 'items' : 'item'}
</EuiPopoverTitle>
Expand Down Expand Up @@ -264,8 +263,7 @@ const trailingControlColumns = [
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
/>
}
closePopover={() => setIsPopoverOpen(false)}
ownFocus={true}>
closePopover={() => setIsPopoverOpen(false)}>
<EuiPopoverTitle>Actions</EuiPopoverTitle>
<div style={{ width: 150 }}>
<button onClick={() => {}} component="span">
Expand Down
3 changes: 1 addition & 2 deletions src-docs/src/views/datagrid/datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ const trailingControlColumns = [
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
/>
}
closePopover={() => setIsPopoverOpen(false)}
ownFocus={true}>
closePopover={() => setIsPopoverOpen(false)}>
<EuiPopoverTitle>Actions</EuiPopoverTitle>
<div style={{ width: 150 }}>
<button onClick={() => {}}>
Expand Down
2 changes: 0 additions & 2 deletions src-docs/src/views/expression/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export default () => {
}
isOpen={example1.isOpen}
closePopover={closeExample1}
ownFocus
display="block"
panelPaddingSize="s"
anchorPosition="downLeft">
Expand All @@ -176,7 +175,6 @@ export default () => {
}
isOpen={example2.isOpen}
closePopover={closeExample2}
ownFocus
display="block"
anchorPosition="downLeft">
{renderPopover2()}
Expand Down
2 changes: 0 additions & 2 deletions src-docs/src/views/expression/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export default () => {
}
isOpen={example1.isOpen}
closePopover={closeExample1}
ownFocus
panelPaddingSize="s"
anchorPosition="downLeft">
{renderPopover1()}
Expand All @@ -164,7 +163,6 @@ export default () => {
}
isOpen={example2.isOpen}
closePopover={closeExample2}
ownFocus
anchorPosition="downLeft">
{renderPopover2()}
</EuiPopover>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/filter_group/filter_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export default () => {
</EuiFilterButton>
<EuiPopover
id="popover"
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/filter_group/filter_group_multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default () => {
<EuiFilterGroup>
<EuiPopover
id="popoverExampleMultiSelect"
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
2 changes: 0 additions & 2 deletions src-docs/src/views/form_layouts/inline_popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export default () => {
<div>
<EuiPopover
id="inlineFormPopover"
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand All @@ -121,7 +120,6 @@ export default () => {
&emsp;
<EuiPopover
id="formPopover"
ownFocus
button={button2}
isOpen={isPopover2Open}
closePopover={closePopover2}>
Expand Down
3 changes: 0 additions & 3 deletions src-docs/src/views/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ const HeaderUserMenu = () => {
return (
<EuiPopover
id={id}
ownFocus
button={button}
isOpen={isOpen}
anchorPosition="downRight"
Expand Down Expand Up @@ -286,7 +285,6 @@ const HeaderSpacesMenu = () => {
return (
<EuiPopover
id={id}
ownFocus
button={button}
isOpen={isOpen}
anchorPosition="downLeft"
Expand Down Expand Up @@ -358,7 +356,6 @@ const HeaderAppMenu = () => {
return (
<EuiPopover
id={popoverId}
ownFocus
button={button}
isOpen={isOpen}
anchorPosition="downRight"
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/header/header_alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ const HeaderUserMenu = () => {
return (
<EuiPopover
id={id}
ownFocus
repositionOnScroll
button={button}
isOpen={isOpen}
Expand Down
3 changes: 0 additions & 3 deletions src-docs/src/views/header/header_elastic_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export default ({ theme }) => {
const userMenu = (
<EuiPopover
id="guideHeaderUserMenuExample"
ownFocus
repositionOnScroll
button={
<EuiHeaderSectionItemButton
Expand Down Expand Up @@ -181,7 +180,6 @@ export default ({ theme }) => {
const spacesMenu = (
<EuiPopover
id="guideHeaderSpacesMenuExample"
ownFocus
repositionOnScroll
button={
<EuiHeaderSectionItemButton
Expand Down Expand Up @@ -217,7 +215,6 @@ export default ({ theme }) => {
const deploymentMenu = (
<EuiPopover
id="guideHeaderDeploymentMenuExample"
ownFocus
repositionOnScroll
button={
<EuiBadge
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default () => {

return (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand Down
12 changes: 0 additions & 12 deletions src-docs/src/views/popover/popover_anchor_position.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export default () => {
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -104,7 +103,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -122,7 +120,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -144,7 +141,6 @@ export default () => {
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -162,7 +158,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -180,7 +175,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -202,7 +196,6 @@ export default () => {
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -220,7 +213,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -238,7 +230,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -260,7 +251,6 @@ export default () => {
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -278,7 +268,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand All @@ -296,7 +285,6 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default () => {

return (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default () => {
return (
<EuiPanel panelRef={setPanelRef}>
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
9 changes: 1 addition & 8 deletions src-docs/src/views/popover/popover_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,21 @@ const inputPopoverSource = require('!!raw-loader!./input_popover');
const inputPopoverHtml = renderToHtml(PopoverBlock);

const popOverSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
<!-- Popover content -->
</EuiPopover>`;

const trapFocusSnippet = `<EuiPopover
ownFocus={false}
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
<!-- Popover content -->
</EuiPopover>`;

const popoverAnchorSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -83,7 +82,6 @@ const popoverAnchorSnippet = `<EuiPopover
</EuiPopover>`;

const popoverWithTitleSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand All @@ -93,7 +91,6 @@ const popoverWithTitleSnippet = `<EuiPopover
</EuiPopover>`;

const popoverPanelClassNameSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -103,7 +100,6 @@ const popoverPanelClassNameSnippet = `<EuiPopover
</EuiPopover>`;

const popoverWithTitlePaddingSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -114,7 +110,6 @@ const popoverWithTitlePaddingSnippet = `<EuiPopover
</EuiPopover>`;

const popoverContainerSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -123,7 +118,6 @@ const popoverContainerSnippet = `<EuiPopover
</EuiPopover>`;

const popoverFixedSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -132,7 +126,6 @@ const popoverFixedSnippet = `<EuiPopover
</EuiPopover>`;

const popoverBlockSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_fixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default () => {
<EuiButton onClick={toggleExample}>Toggle example</EuiButton>
{isExampleShown && (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_htmlelement_anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const PopoverApp = (props) => {

return (
<EuiWrappingPopover
ownFocus
button={props.anchor}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_panel_class_name.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default () => {

return (
<EuiPopover
ownFocus
button={
<EuiButton
iconType="arrowDown"
Expand Down
Loading

0 comments on commit df90c3b

Please sign in to comment.