Skip to content

fix(overlay): keep comment-box keystrokes from reaching the host page - #15

Merged
seanpk merged 1 commit into
masterfrom
fix/overlay-key-leak
Oct 24, 2026
Merged

seanpk merged 1 commit into
masterfrom
fix/overlay-key-leak

Conversation

@seanpk

@seanpk seanpk commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Typing in the overlay's comment box triggers keyboard shortcuts on the host page. On a Reveal.js deck, typing v, n, f, space, or an arrow key in the textarea navigates or toggles the deck instead of just entering text.

Key events from the textarea bubble out of the shadow root to document, where they are retargeted to the shadow host. A host page listening on document sees a DIV as activeElement, not a textarea, and acts on the key.

Changes

  • The shadow host stops keydown, keyup, and keypress when the event started in an editable element (assets/overlay/ui/shadow.js). isEditable is now exported.
  • Esc is consumed only when the overlay has something to dismiss: a popover is open, an element is selected, or the queue is open. ? is consumed only when it opens the queue (assets/overlay/app.js).
  • Behaviour change for review: Esc now also closes the queue panel.
  • UX-12 and UX-13 added to docs/REQUIREMENTS.md, and a CHANGELOG entry under Unreleased.

Tests

  • test/unit/key-isolation.test.js and test/browser/key-isolation.spec.js are new.
  • npm test: 55 unit and 13 server tests pass, and the requirement coverage gate passes.
  • npm run test:browser: 35 pass. With the overlay changes stashed, 3 of the 5 new browser tests fail.
  • linkedom does not retarget events across the shadow boundary, so the unit test dispatches on the host and stubs composedPath. The Playwright spec covers the real shadow behaviour.

🤖 Generated with Claude Code

🤖 Claude on behalf of Sean

…t page

Key events from the comment textarea bubbled out of the shadow root to
document, retargeted to the host, so pages that listen there (Reveal.js
is the case in hand) acted on them. The shadow host now stops key events
that start in an editable element. Esc is consumed only when the overlay
has something to dismiss, and ? only when it opens the queue. UX-12 and
UX-13 in REQUIREMENTS, with unit and Playwright coverage.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@seanpk
seanpk merged commit a1524da into master Oct 24, 2026
4 checks passed
@seanpk
seanpk deleted the fix/overlay-key-leak branch October 24, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant