mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-10-21 05:01:26 -07:00
fix(overlay): treat Hachidori popup host as a lookup target for keys
- Match the Hachidori shadow-root host alongside the Yomitan popup host when routing keyboard events - Update the keyboard test stub to use HACHIDORI_HOST_SELECTOR
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -5,7 +5,7 @@ import test from 'node:test';
|
||||
|
||||
import { createKeyboardHandlers } from './keyboard.js';
|
||||
import { createRendererState } from '../state.js';
|
||||
import { YOMITAN_POPUP_HOST_SELECTOR } from '../yomitan-popup.js';
|
||||
import { HACHIDORI_HOST_SELECTOR } from '../yomitan-popup.js';
|
||||
import type { CompiledSessionBinding } from '../../types';
|
||||
import type { MpvInputBindingsSnapshot } from '../../types/session-bindings';
|
||||
import { DEFAULT_KEYBINDINGS, SPECIAL_COMMANDS } from '../../config/definitions';
|
||||
@@ -482,7 +482,7 @@ function installKeyboardTestGlobals() {
|
||||
selector
|
||||
.split(',')
|
||||
.map((part) => part.trim())
|
||||
.includes(YOMITAN_POPUP_HOST_SELECTOR)
|
||||
.includes(HACHIDORI_HOST_SELECTOR)
|
||||
? target
|
||||
: null;
|
||||
return target;
|
||||
|
||||
@@ -83,7 +83,7 @@ export function createKeyboardHandlers(
|
||||
if (ctx.dom.subtitleContainer.contains(target)) return true;
|
||||
if (isYomitanPopupIframe(target)) return true;
|
||||
// Hachidori's popup lives in a shadow root, so its events arrive retargeted to the host.
|
||||
if (target.closest(YOMITAN_POPUP_HOST_SELECTOR)) return true;
|
||||
if (target.closest(`${YOMITAN_POPUP_HOST_SELECTOR}, ${HACHIDORI_HOST_SELECTOR}`)) return true;
|
||||
if (target.closest && target.closest('iframe.yomitan-popup, iframe[id^="yomitan-popup"]'))
|
||||
return true;
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user