Merge branch 'preview-fixes'

This commit is contained in:
the1812 2025-02-28 09:10:37 +08:00
commit ce4ee6223b

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