diff --git a/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue b/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue
index 78ad1867..1c3ab5b6 100644
--- a/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue
+++ b/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue
@@ -1,7 +1,7 @@
@@ -331,6 +335,7 @@ watch(editorOpen, (v) => {
diff --git a/packages/core/src/client/webcomponents/state/commands.ts b/packages/core/src/client/webcomponents/state/commands.ts
index 8b46271d..20c7444d 100644
--- a/packages/core/src/client/webcomponents/state/commands.ts
+++ b/packages/core/src/client/webcomponents/state/commands.ts
@@ -4,9 +4,10 @@ import type { SharedState } from 'devframe/utils/shared-state'
import type { WhenContext } from 'devframe/utils/when'
import type { ShallowRef } from 'vue'
import { evaluateWhen } from 'devframe/utils/when'
-import { computed, markRaw, reactive, ref } from 'vue'
+import { computed, markRaw, reactive, ref, watch } from 'vue'
import { sharedStateToRef } from './docks'
import { collectAllKeybindings, normalizeKeyEvent } from './keybindings'
+import { useDockPopupWindow } from './popup'
export { formatKeybinding, isMac, normalizeKeyEvent } from './keybindings'
@@ -179,6 +180,14 @@ function setupShortcutListener(
}
}
- // Attach to window — works for both embedded (shadow DOM) and standalone
+ // Attach to the host window. This covers embedded (shadow DOM) mode and the
+ // host page while a popup is open.
window.addEventListener('keydown', handler, { capture: true })
+
+ watch(useDockPopupWindow(), (popup, prev) => {
+ if (prev)
+ prev.removeEventListener('keydown', handler, { capture: true })
+ if (popup)
+ popup.addEventListener('keydown', handler, { capture: true })
+ })
}