Skip to content

Commit

Permalink
Switches flyout close on ESC to window event
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrhodes committed Aug 20, 2018
1 parent 55535bb commit 48608b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/flyout/flyout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { keyCodes } from '../../services';

import { EuiOverlayMask } from '../overlay_mask';
import { EuiButtonIcon } from '../button';
import { EuiWindowEvent } from '../window_event';

const sizeToClassNameMap = {
s: 'euiFlyout--small',
Expand All @@ -20,7 +21,6 @@ export class EuiFlyout extends Component {
onKeyDown = event => {
if (event.keyCode === keyCodes.ESCAPE) {
event.preventDefault();
event.stopPropagation();
this.props.onClose();
}
};
Expand Down Expand Up @@ -90,6 +90,7 @@ export class EuiFlyout extends Component {

return (
<span>
<EuiWindowEvent event="keydown" handler={this.onKeyDown} />
{optionalOverlay}
{/* Trap focus even when ownFocus={false}, otherwise closing the flyout won't return focus
to the originating button */}
Expand Down

0 comments on commit 48608b7

Please sign in to comment.