-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix ControlOrMeta key normalization in keyPress #1511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add support for normalizing the "ControlOrMeta" key string to the appropriate platform modifier. This key is sent by Google CUA when clearBeforeTyping is enabled for form filling operations. Without this normalization, the modifier was not recognized and only the "A" character was typed, causing a "type A, backspace, then fill" pattern that confused users. 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <[email protected]>
🦋 Changeset detectedLatest commit: f1106a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR adds support for the "ControlOrMeta" modifier key by normalizing it to "Meta" on macOS and "Control" on other platforms in the normalizeModifierKey method. This fixes keyboard shortcuts like Cmd/Ctrl+A when Google CUA uses clearBeforeTyping for form filling.
Key Changes:
- Added
case "controlormeta":to the switch statement innormalizeModifierKey()method (line 1890) - Maps to the same logic as
"cmd"and"command"cases - returns"Meta"on macOS,"Control"elsewhere - Fixes the issue where Google CUA's
type_text_atwithclearBeforeTypingsends"ControlOrMeta+A"for select-all operations
Context:
Google CUA client sends "ControlOrMeta" as a modifier key (line 747 in GoogleCUAClient.ts) when clearBeforeTyping is enabled. Without this normalization, the key combination would not be recognized, causing unexpected behavior.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The change is a simple, isolated addition to an existing switch statement that adds support for a cross-platform modifier key. It follows the exact same pattern as existing cases (
"cmd"and"command"), maps correctly based on platform detection, and directly addresses the documented issue. The implementation is consistent with the codebase's existing architecture. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/core/lib/v3/understudy/page.ts | 5/5 | Added "controlormeta" case to normalize modifier key for cross-platform keyboard shortcuts (Mac: Meta, others: Control) |
Sequence Diagram
sequenceDiagram
participant GC as Google CUA Client
participant Page as Page.keyPress()
participant NK as normalizeModifierKey()
participant CDP as Chrome DevTools Protocol
Note over GC: clearBeforeTyping enabled
GC->>Page: keyPress("ControlOrMeta+A")
Page->>Page: Split key combination
Page->>NK: normalizeModifierKey("ControlOrMeta")
alt macOS platform
NK-->>Page: "Meta"
else Other platforms
NK-->>Page: "Control"
end
Page->>Page: keyDown(modifier)
Page->>Page: keyDown("A")
Page->>CDP: Input.dispatchKeyEvent (rawKeyDown)
Note over CDP: Cmd+A on Mac<br/>Ctrl+A on Windows/Linux
CDP-->>Page: Text selection executed
Page->>Page: keyUp("A")
Page->>Page: keyUp(modifier)
Summary
Fix support for the "ControlOrMeta" modifier key in keyboard event handling. This key is sent by Google CUA when clearBeforeTyping is enabled for form filling. Without this normalization, users saw unexpected "type A, backspace, then fill" behavior.
Test Plan
🤖 Generated with Claude Code
Summary by cubic
Fix keyboard modifier normalization by mapping "ControlOrMeta" to Meta on macOS and Control on other platforms. This restores shortcuts like Cmd/Ctrl+A during Google CUA clear-before-typing form filling and prevents the "type A, backspace, then fill" behavior.
Written for commit f1106a9. Summary will update on new commits.