[MM-40603] Add timeout for alt press to make sure it doesn't interfere with OS shortcuts (#1932) (#1940)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
(cherry picked from commit 8474683ff1
)
Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
This commit is contained in:
parent
99183613af
commit
36bc2a4e31
|
@ -61,6 +61,7 @@ export class MattermostView extends EventEmitter {
|
|||
|
||||
currentFavicon?: string;
|
||||
hasBeenShown: boolean;
|
||||
altTimeout?: number;
|
||||
altLastPressed?: boolean;
|
||||
contextMenu: ContextMenu;
|
||||
|
||||
|
@ -293,6 +294,7 @@ export class MattermostView extends EventEmitter {
|
|||
// Handler for pressing the Alt key to focus the 3-dot menu
|
||||
if (input.key === 'Alt' && input.type === 'keyUp' && this.altLastPressed) {
|
||||
this.altLastPressed = false;
|
||||
clearTimeout(this.altTimeout);
|
||||
WindowManager.focusThreeDotMenu();
|
||||
return;
|
||||
}
|
||||
|
@ -300,8 +302,12 @@ export class MattermostView extends EventEmitter {
|
|||
// Hack to detect keyPress so that alt+<key> combinations don't default back to the 3-dot menu
|
||||
if (input.key === 'Alt' && input.type === 'keyDown') {
|
||||
this.altLastPressed = true;
|
||||
this.altTimeout = setTimeout(() => {
|
||||
this.altLastPressed = false;
|
||||
}, 500) as unknown as number;
|
||||
} else {
|
||||
this.altLastPressed = false;
|
||||
clearTimeout(this.altTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue