mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Disabled default behavior for modal open keyboard shortcut
refs https://github.com/TryGhost/Team/issues/1665 - disables browser behavior for cmd/ctrl+k for opening search modal
This commit is contained in:
parent
fa4adcd365
commit
312ecdbac3
2 changed files with 1 additions and 18 deletions
|
@ -67,6 +67,7 @@ export default class App extends React.Component {
|
|||
this.setState({
|
||||
showPopup: true
|
||||
});
|
||||
return false;
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', this.handleKeyDown);
|
||||
|
|
|
@ -80,18 +80,6 @@ class PopupContent extends React.Component {
|
|||
static contextType = AppContext;
|
||||
|
||||
componentDidMount() {
|
||||
// Handle Esc to close popup
|
||||
if (this.node) {
|
||||
this.node.focus();
|
||||
this.keyUphandler = (event) => {
|
||||
const eventTargetTag = (event.target && event.target.tagName);
|
||||
if (event.key === 'Escape' && eventTargetTag !== 'INPUT') {
|
||||
// this.context.onAction('closePopup');
|
||||
}
|
||||
};
|
||||
this.node.ownerDocument.removeEventListener('keyup', this.keyUphandler);
|
||||
this.node.ownerDocument.addEventListener('keyup', this.keyUphandler);
|
||||
}
|
||||
this.sendContainerHeightChangeEvent();
|
||||
}
|
||||
|
||||
|
@ -103,12 +91,6 @@ class PopupContent extends React.Component {
|
|||
this.sendContainerHeightChangeEvent();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.node) {
|
||||
this.node.ownerDocument.removeEventListener('keyup', this.keyUphandler);
|
||||
}
|
||||
}
|
||||
|
||||
handlePopupClose(e) {
|
||||
e.preventDefault();
|
||||
if (e.target === e.currentTarget) {
|
||||
|
|
Loading…
Add table
Reference in a new issue