fix(helpers): make press_key handle keyboard shortcuts#332
Open
immanuwell wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Tiny fix for
press_key()shortcuts. Ctrl/Cmd/Alt combos should not send printable text, and letter/digit keys need Chrome-style metadata likeKeyA/65.No big rewrite, just the busted bit.
Repro
Before:
keyDown text="a", then acharevent, withcode="a"and vk97. In real Chrome, textareaabc+ Ctrl+A +type_text("x")does not select cleanly. kinda cooked.After: only
keyDown/keyUp,code="KeyA", vk65; the same Chrome smoke ends withx.Checks
uv run --with pytest pytest -qRelated: #297, same edge; this is the smaller patch.
Summary by cubic
Fix
press_keyto handle keyboard shortcuts correctly. Modifiers no longer emit printable text, and letters/digits now include Chrome-stylecodeand VK metadata.text/charevents when Alt/Ctrl/Meta modifiers are present.KeyXand digits toDigitNwith correctwindowsVirtualKeyCode.Written for commit 33cf31c. Summary will update on new commits.