Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- Fixed `EuiComboBox`'s options list from staying open when scrolled in a container by auto-closing the list on scroll ([#2106](https://github.com/elastic/eui/pull/2106))
- Fixed content provided to `EuiListGroupItem` and `EuiFilterButton` `title` attribute to prevent unreadable popover ([#2100](https://github.com/elastic/eui/pull/2100))
- Fixed a nearly infinite `requestAnimationFrame` loop caused by `focus` state changes in nested `EuiPopover` components ([#2110](https://github.com/elastic/eui/pull/2110))

## [`12.3.1`](https://github.com/elastic/eui/tree/v12.3.1)

Expand Down
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
8 changes: 5 additions & 3 deletions src/components/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ export class EuiPopover extends Component {
);

setTimeout(() => {
this.setState({ isOpenStable: true }, this.positionPopoverFixed);
this.setState({ isOpenStable: true }, () => {
this.positionPopoverFixed();
this.updateFocus();
});
}, durationMatch + delayMatch);
}

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

this.updateFocus();
}

componentWillUnmount() {
Expand Down Expand Up @@ -484,6 +485,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