CodeMirror uses a contenteditable surface, which the split-pane focus filter treated as exempt. Let editor interactions claim pane focus just like composer text inputs do.
18 lines
498 B
TypeScript
18 lines
498 B
TypeScript
const INTERACTIVE_TARGET_SELECTOR = [
|
|
"a",
|
|
"button",
|
|
"select",
|
|
"[role='button']",
|
|
"[role='link']",
|
|
"[data-paseo-pane-focus-exempt='true']",
|
|
].join(", ");
|
|
|
|
export function shouldFocusPaneFromEventTarget(target: EventTarget | null): boolean {
|
|
const candidate = target as unknown as { closest?: (selector: string) => Element | null } | null;
|
|
if (!candidate || typeof candidate.closest !== "function") {
|
|
return true;
|
|
}
|
|
|
|
return !candidate.closest(INTERACTIVE_TARGET_SELECTOR);
|
|
}
|