Skip to content

fix(bidi): keyboard fixes (Enter code, Space key, Abort/NumpadEnter) - #3736

Closed
kblok wants to merge 1 commit into
masterfrom
claude/issue-3701-1hn8x7
Closed

kblok wants to merge 1 commit into
masterfrom
claude/issue-3701-1hn8x7

Conversation

@kblok

@kblok kblok commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Closes #3701

Ports upstream puppeteer #15743 (Enter sends the Enter code ), #15650 (Space key) and #15654 (Abort maps to Cancel, NumpadEnter maps to ) in BidiKeyboard.GetBidiKeyValue. Adds the two upstream keyboard tests.

Upstream parity

Verdict: matches upstream bidi/Input.ts getBidiKeyValue for the three PRs (Enter/NumpadEnter, Abort, Space) and the upstream tests were ported. The /hardkoded:upstream-parity-check skill was not run (not invocable here); I compared the code to upstream by hand. Not verified by tests: the test project build failed locally on the dev-certificate setup, so only the library compile was checked.


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard input handling for Enter, Numpad Enter, Space, Cancel, and Abort. Enter and Numpad Enter now produce distinct keyboard codes, and Space inserts a space in text areas.
  • Tests
    • Added coverage for Enter and Numpad Enter keyboard codes, newline input, and inserting a space in a text area.

Ports puppeteer#15743, #15650 and #15654.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls2e1ybZmj9BdjyghKGrcF
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Bidi keyboard mapping now handles Enter, NumpadEnter, Abort, and Space with updated key values. New tests check Enter and NumpadEnter codes and Space insertion into a textarea.

Changes: Bidi keyboard mappings

Layer / File(s) Summary
Update key mappings and tests
lib/PuppeteerSharp/Bidi/BidiKeyboard.cs, lib/PuppeteerSharp.Tests/KeyboardTests/KeyboardTests.cs
The Bidi mapping changes the values for Enter and NumpadEnter, adds Abort as an alias for Cancel, and maps Space to a literal space. Tests check Enter and NumpadEnter codes and Space insertion into a textarea.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to a5a82

This PR fixes the Enter, NumpadEnter, Abort, and Space key mappings in the Bidi keyboard to match upstream Puppeteer. No concrete merge-blocking risk was found. The new tests should be run in CI to confirm browser behavior.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#3701] asks for three upstream keyboard fixes: Enter code, Space key, and Abort/NumpadEnter. The diff to lib/PuppeteerSharp/Bidi/BidiKeyboard.cs implements all three in GetBidiKeyValue: Enter maps to… Build and run the two new tests in KeyboardTests (ShouldSendTheEnterCodeForEnter and ShouldPressTheSpaceKey) against the BiDi-enabled browser setup. Confirm they pass. Also confirm that the existing keyboard tests that use Enter still pass …
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the bidi keyboard fixes that the changeset makes: the Enter code, the Space key, and the Abort/NumpadEnter mappings in BidiKeyboard.GetBidiKeyValue. The title is specific, matches the …
Out of Scope Changes check Passed All changed hunks map to the objectives in #3701. The BidiKeyboard.cs changes cover Enter, NumpadEnter, Abort, and Space. The KeyboardTests.cs changes are the two upstream-derived tests that support t…
Full details: Title check

Explanation

The title names the bidi keyboard fixes that the changeset makes: the Enter code, the Space key, and the Abort/NumpadEnter mappings in BidiKeyboard.GetBidiKeyValue. The title is specific, matches the main change, and follows the conventional-commit style. It does not list every detail, which is acceptable.

Full details: Out of Scope Changes check

Explanation

All changed hunks map to the objectives in #3701. The BidiKeyboard.cs changes cover Enter, NumpadEnter, Abort, and Space. The KeyboardTests.cs changes are the two upstream-derived tests that support those objectives. No unrelated files or hunks appear in the reviewed diff. The raw summary lists only these two files.

Full details: Linked Issues check

Explanation

[#3701] asks for three upstream keyboard fixes: Enter code, Space key, and Abort/NumpadEnter. The diff to lib/PuppeteerSharp/Bidi/BidiKeyboard.cs implements all three in GetBidiKeyValue: Enter maps to \uE006 (was \uE007), NumpadEnter maps to \uE007, Abort maps to \uE001 with Cancel, and Space maps to " ". The diff also adds two tests in KeyboardTests.cs (Enter/NumpadEnter codes and Space inserting a space into a textarea). The code matches the PR description's summary of the upstream fixes. Two gaps remain. First, the author did not build or run the test project, so the new tests and the behavior change are unverified. Second, the upstream bidi/Input.ts source is not in this repository, so parity with upstream was checked by hand only. The Enter change from \uE007 to \uE006 changes existing behavior and depends on the browser mapping, so it needs runtime confirmation.

Resolution

Build and run the two new tests in KeyboardTests (ShouldSendTheEnterCodeForEnter and ShouldPressTheSpaceKey) against the BiDi-enabled browser setup. Confirm they pass. Also confirm that the existing keyboard tests that use Enter still pass after the \uE006 change. Provide the upstream bidi/Input.ts getBidiKeyValue source or its test expectations so parity can be checked directly.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 530b41d1-27c8-474e-8faa-1fe3e262c41f
Commits

Reviewing files that changed from the base of the PR and between e2382f1 and a5a825a.

Files selected for processing: 2

  • lib/PuppeteerSharp.Tests/KeyboardTests/KeyboardTests.cs
  • lib/PuppeteerSharp/Bidi/BidiKeyboard.cs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

kblok commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Closing: master already contains these changes (#3677); this branch only duplicated its tests (CS0111 build error).


Generated by Claude Code

@kblok kblok closed this Nov 12, 2026
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.

[Upstream] fix(bidi): keyboard fixes (Enter code, Space key, Abort/NumpadEnter, exhaustive getBidiKeyValue)

2 participants