Skip to content

fix(extension): prevent host page from capturing keyboard input - #60

Merged
comppaz merged 1 commit into
mainfrom
fix/extension-keyboard-capture
Dec 19, 2025
Merged

fix(extension): prevent host page from capturing keyboard input#60
comppaz merged 1 commit into
mainfrom
fix/extension-keyboard-capture

Conversation

@comppaz

@comppaz comppaz commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

Summary

Fixes keyboard input being captured by host pages (like Claude.ai) when using the Think extension.

Problem: When using the extension on Claude.ai, the cursor would appear in the Think input field, but keystrokes would go to Claude's chat input instead. This was because Claude.ai uses global keyboard event listeners that intercept keystrokes.

Solution: Add event isolation to the Shadow DOM to prevent focus and keyboard events from propagating to the host document.

Changes

  • Add delegatesFocus: true option to Shadow DOM for better focus handling
  • Stop focus events (focusin/focusout) from propagating to host document
  • Stop keyboard events (keydown/keyup/keypress) from propagating to host document

Test plan

  • Build extension successfully
  • Load extension in browser
  • Open Claude.ai and start a chat
  • Open Think extension sidebar
  • Verify typing in Think input works correctly (keystrokes go to Think, not Claude)

Fixes #47

Add event isolation to Shadow DOM to prevent sites like Claude.ai from
intercepting keyboard events and focus changes intended for the extension.

- Add delegatesFocus option for better focus handling
- Stop focus events from propagating to host document
- Stop keyboard events from propagating to host document

Fixes #47
@comppaz
comppaz merged commit 45c37b2 into main Dec 19, 2025
1 check passed
@comppaz
comppaz deleted the fix/extension-keyboard-capture branch December 19, 2025 10:05
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.

bug: During Claude Chat can not chat with Think-Extension

1 participant