Skip to content
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

EuiFormRow with nested EuiPopovers using ownFocus #2110

Merged
merged 6 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src-docs/src/views/color_picker/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,18 @@ export default class extends Component {
{colorPicker}
</EuiFormRow>

<EuiPopover
id="popover"
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={this.closePopover}>
<div style={{ width: '300px' }}>
<EuiFormRow label="Color picker">{colorPicker}</EuiFormRow>
</div>
</EuiPopover>
<EuiFormRow label="Unruly focus management">
<EuiPopover
id="popover"
ownFocus={true}
button={button}
isOpen={isPopoverOpen}
closePopover={this.closePopover}>
<div style={{ width: '300px' }}>
<EuiFormRow label="Color picker">{colorPicker}</EuiFormRow>
</div>
</EuiPopover>
</EuiFormRow>

<EuiSpacer size="m" />

Expand Down
4 changes: 2 additions & 2 deletions src/components/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class EuiPopover extends Component {

setTimeout(() => {
this.setState({ isOpenStable: true }, this.positionPopoverFixed);
this.updateFocus();
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
}, durationMatch + delayMatch);
}

Expand All @@ -260,8 +261,6 @@ export class EuiPopover extends Component {
});
}, 250);
}

this.updateFocus();
}

componentWillUnmount() {
Expand Down Expand Up @@ -475,6 +474,7 @@ export class EuiPopover extends Component {
panel = (
<EuiPortal insert={insert}>
<EuiFocusTrap
returnFocus={!this.state.isOpening} // Ignore temporary state of indecisive focus
clickOutsideDisables={true}
initialFocus={initialFocus}
disabled={!ownFocus}>
Expand Down