diff --git a/js/background.js b/js/background.js index a42b3f5832..3777ac87f0 100644 --- a/js/background.js +++ b/js/background.js @@ -655,6 +655,15 @@ // NAVIGATION // Show keyboard shortcuts - handled by Electron-managed keyboard shortcuts + // However, on linux Ctrl+/ selects all text, so we prevent that + if (ctrlOrCommand && key === '/') { + window.showKeyboardShortcuts(); + + event.stopPropagation(); + event.preventDefault(); + + return; + } // Navigate by section if (ctrlOrCommand && !shiftKey && (key === 't' || key === 'T')) { diff --git a/ts/components/MainHeader.tsx b/ts/components/MainHeader.tsx index 63052ed6f8..4527299288 100644 --- a/ts/components/MainHeader.tsx +++ b/ts/components/MainHeader.tsx @@ -217,7 +217,18 @@ export class MainHeader extends React.Component { searchTerm, } = this.props; - if (event.key !== 'Escape') { + const { ctrlKey, metaKey, key } = event; + const ctrlOrCommand = ctrlKey || metaKey; + + // On linux, this keyboard combination selects all text + if (ctrlOrCommand && key === '/') { + event.preventDefault(); + event.stopPropagation(); + + return; + } + + if (key !== 'Escape') { return; } diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 8f69e32ffb..58aa8ca5f8 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -7560,7 +7560,7 @@ "rule": "React-createRef", "path": "ts/components/MainHeader.js", "line": " this.inputRef = react_1.default.createRef();", - "lineNumber": 126, + "lineNumber": 134, "reasonCategory": "usageTrusted", "updated": "2019-08-09T21:17:57.798Z", "reasonDetail": "Used only to set focus"