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

fix(ui): disable hotkeys when modal is hidden #850

Merged
merged 1 commit into from
Jul 31, 2019
Merged
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
22 changes: 12 additions & 10 deletions ui/src/Components/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,24 @@ const Modal = observer(
const { size, isOpen, toggleOpen, children, ...props } = this.props;

return ReactDOM.createPortal(
<HotKeys
innerRef={this.HotKeysRef}
keyMap={{ CLOSE: "Escape" }}
handlers={{ CLOSE: toggleOpen }}
>
<React.Fragment>
<MountModal in={isOpen} unmountOnExit {...props}>
<div ref={this.modalRef} className="modal d-block" role="dialog">
<div className={`modal-dialog modal-${size}`} role="document">
<div className="modal-content">{children}</div>
<HotKeys
innerRef={this.HotKeysRef}
keyMap={{ CLOSE: "Escape" }}
handlers={{ CLOSE: toggleOpen }}
>
<div ref={this.modalRef} className="modal d-block" role="dialog">
<div className={`modal-dialog modal-${size}`} role="document">
<div className="modal-content">{children}</div>
</div>
</div>
</div>
</HotKeys>
</MountModal>
<MountModalBackdrop in={isOpen} unmountOnExit>
<div className="modal-backdrop d-block" />
</MountModalBackdrop>
</HotKeys>,
</React.Fragment>,
document.body
);
}
Expand Down