fix(lock): lock screen swallowed every keystroke; add Ctrl+L to lock

The renderer-side guard added in v1.0.17 called preventDefault on every
keydown while locked. A keydown's default action IS inserting the
character into the focused field, so the lock screen's password box
received nothing and a locked app could never be unlocked. Menu
accelerators are already stopped in main (before-input-event); the
renderer guard now just skips its own logic.

Also: Ctrl+L locks the screen from anywhere in the app, terminals
included. The chord is only taken when a lock actually engages, so an
unconfigured app keeps Ctrl+L for the shell's clear-screen.
This commit is contained in:
Bill committed 2026-09-24 22:53:27 +08:00
1 parent 244199c512
commit 83dc3f15cc
7 files changed
+31 -15

No files matched your search

+7 -9
View File
@@ -157,15 +157,13 @@ function FontHotkeyListener(): null {
useEffect(() => {
const onKeyDown = (e: KeyboardEvent): void => {
// The lock overlay leaves Workspace mounted; window-capture hotkeys must
// not mutate font size on a shell hidden behind it. preventDefault matters
// here: returning alone lets the chord reach Electron's default menu
// accelerators (zoomIn/zoomOut/resetZoom), which rescale the whole UI
// behind the opaque mask and make Chromium persist that zoom per origin.
if (document.documentElement.dataset.locked === 'true') {
e.preventDefault()
return
}
// While locked, skip only this listener's own logic — and NEVER call
// preventDefault here. The default action of a keydown is inserting the
// character into the focused field, and it runs after the whole dispatch:
// preventing it at window level kills every keystroke the lock screen's
// password field would receive (shipped broken in v1.0.17). The menu
// accelerators are stopped in main, on before-input-event, instead.
if (document.documentElement.dataset.locked === 'true') return
if (!e.ctrlKey || e.metaKey) return
const target = e.target as HTMLElement | null
const isXtermHelper =