Skip to content

Cancel the iframe shim's pending leader tap when another key is pressed - #1372

Open
dormouse-bot wants to merge 1 commit into
mainfrom
fix/iframe-shim-leader-reset
Open

dormouse-bot wants to merge 1 commit into
mainfrom
fix/iframe-shim-leader-reset

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

Typing in a proxied iframe Surface could drop the pane out of passthrough. The injected shim posts leader on a left-then-right Shift (or Meta) tap within 500 ms, but its detector never cleared a pending tap when another key came in between. So typing "I Am" into a text field in the frame (left Shift for the I, right Shift for the A) read as the chord, and the Wall's leader handler in use-wall-keyboard.ts called exitTerminalMode() mid-sentence. The Wall's own detector already resets on any other key. docs/specs/dor-browser.md → "Iframe Shim" says a leader message "exits passthrough like an in-document dual-tap", so the shim now does the same reset.

The same comment block in iframe-proxy-rewrite.ts said the shim posts four message kinds. It posts five, and the spec lists theme-request too, so the comment now does as well.

Verification: a new test in lib/src/host/iframe-proxy-rewrite.test.ts drives the shim's keydown listener through the existing shimFrame harness. It expects leader for the bare Shift and Meta gestures and none when a letter or space falls between the taps. This sandbox has no pnpm, so I couldn't run vitest locally. Instead I ran the shim's source in a node:vm probe built the same way as the harness: the gesture posts leader twice before and after the fix, and the typing sequence posts it twice before the fix and zero times after. CI runs the vitest case.

The shim's dual-tap detector never reset between Shift or Meta taps, so
typing a left-Shift capital, a word, then a right-Shift capital inside a
proxied iframe posted 'leader' and dropped the pane out of passthrough.
The Wall's own detector already resets on any other key.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5698be5
Status: ✅  Deploy successful!
Preview URL: https://51771abd.mouseterm.pages.dev
Branch Preview URL: https://fix-iframe-shim-leader-reset.mouseterm.pages.dev

View logs

This branch has not been deployed

No deployments
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