Skip to content

Commit

Permalink
fix(modal): prevent bubbling on ESC on inactive (#2313)
Browse files Browse the repository at this point in the history
Fixes #2312.
  • Loading branch information
asudoh authored Apr 17, 2019
1 parent 4b55b79 commit ceed10d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class Modal extends mixin(createComponent, initComponentByLauncher, eventedShowH

this._handleKeydownListener = this.manage(
on(this.element.ownerDocument.body, 'keydown', evt => {
if (evt.which === 27) {
// Avoid running `evt.stopPropagation()` only when modal is shown
if (evt.which === 27 && this.shouldStateBeChanged('hidden')) {
evt.stopPropagation();
this.hide(evt);
}
Expand Down

0 comments on commit ceed10d

Please sign in to comment.