Fix several shortcuts not working with non-EN keyboard layouts
This commit is contained in:
parent
308cef086c
commit
d094a93191
6 changed files with 22 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as KeyboardLayout from '../../services/keyboardLayout';
|
||||
|
||||
export function handleKeydownForSearch(
|
||||
event: Readonly<KeyboardEvent>,
|
||||
{
|
||||
|
@ -13,13 +15,14 @@ export function handleKeydownForSearch(
|
|||
startSearch: () => unknown;
|
||||
}>
|
||||
): void {
|
||||
const { ctrlKey, metaKey, shiftKey, key } = event;
|
||||
const { ctrlKey, metaKey, shiftKey } = event;
|
||||
const commandKey = window.platform === 'darwin' && metaKey;
|
||||
const controlKey = window.platform !== 'darwin' && ctrlKey;
|
||||
const commandOrCtrl = commandKey || controlKey;
|
||||
const commandAndCtrl = commandKey && ctrlKey;
|
||||
const key = KeyboardLayout.lookup(event);
|
||||
|
||||
if (commandOrCtrl && !commandAndCtrl && key.toLowerCase() === 'f') {
|
||||
if (commandOrCtrl && !commandAndCtrl && (key === 'f' || key === 'F')) {
|
||||
if (!shiftKey) {
|
||||
startSearch();
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue