Merge branch 'preview-fixes' into preview-features

This commit is contained in:
the1812 2025-02-28 09:11:17 +08:00
commit 5371e1df08

View File

@ -46,9 +46,16 @@ export const loadKeyBindings = lodash.once((bindings: KeyBinding[]) => {
}
// 忽略其他可聚焦元素
const hasElementFocus = !([document.body, null] as (Element | null)[]).includes(
getActiveElement(),
)
const hasElementFocus = (() => {
const activeElement = getActiveElement()
if (([document.body, null] as (Element | null)[]).includes(activeElement)) {
return false
}
if (activeElement instanceof HTMLMediaElement) {
return false
}
return true
})()
if (
(binding.action.ignoreFocus !== false || binding.action.ignoreTyping !== false) &&
hasElementFocus