Skip to content

Commit

Permalink
Don't scroll back to a popover anchor when the popover closes
Browse files Browse the repository at this point in the history
  • Loading branch information
chandlerprall committed Oct 1, 2020
1 parent 3c1ba1f commit 57abce2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,14 @@ export class EuiPopover extends Component<Props, State> {
`euiPopover__panelArrow--${this.state.arrowPosition}`
);

const returnFocus = this.state.isOpenStable
? { preventScroll: true }
: false;

panel = (
<EuiPortal insert={insert}>
<EuiFocusTrap
returnFocus={this.state.isOpenStable} // Ignore temporary state of indecisive focus
returnFocus={returnFocus} // Ignore temporary state of indecisive focus
clickOutsideDisables={true}
initialFocus={initialFocus}
onDeactivation={onTrapDeactivation}
Expand Down

0 comments on commit 57abce2

Please sign in to comment.