Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ export class PresentationInputBridge {
: originNode?.parentElement instanceof HTMLElement
? originNode.parentElement
: null;

// Skip events from external contenteditable elements (e.g., other TipTap/ProseMirror editors).
// If the event target is in a contenteditable that's not part of our editor, don't intercept.
const originContentEditable = originElement?.closest?.('[contenteditable="true"]') as HTMLElement | null;
if (originContentEditable) {
const targetDom = this.#getTargetDom?.();
const targetRoot = targetDom?.closest?.('.presentation-editor') ?? targetDom?.parentElement;
if (targetRoot && !targetRoot.contains(originContentEditable)) {
return null;
Comment on lines +307 to +310
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not exclude SuperDoc's sibling hidden editors

When the active target is a header/footer or note story editor, its ProseMirror DOM lives in a hidden host appended under document.body, while the stale body editor is in a different hidden host sibling. In that real setup targetDom.closest('.presentation-editor') is null and the fallback targetDom.parentElement is only the active hidden host, so this check treats the stale SuperDoc editor as “external” and returns before rerouting. That breaks the stale-focus handoff this method exists for, letting input continue into the wrong hidden editor instead of the active story surface.

Useful? React with 👍 / 👎.

}
}

const staleEditorTarget = originElement?.closest?.('.ProseMirror[contenteditable="true"]') as HTMLElement | null;

if (!staleEditorTarget || staleEditorTarget === activeTarget) {
Expand Down
Loading