Skip to content

[wrangler] fix: hotkeys work with Caps Lock enabled#13834

Merged
edmundhung merged 5 commits into
cloudflare:mainfrom
matingathani:fix/hotkeys-case-insensitive
May 13, 2026
Merged

[wrangler] fix: hotkeys work with Caps Lock enabled#13834
edmundhung merged 5 commits into
cloudflare:mainfrom
matingathani:fix/hotkeys-case-insensitive

Conversation

@matingathani
Copy link
Copy Markdown
Contributor

Fixes #13449.

When Caps Lock is on (or Shift is held without Ctrl/Meta), Node.js readline emits key events as { name: "a", shift: true } — lowercase letter with shift: true. The hotkey matcher was building "shift+b" from this and comparing against registered keys like "b", silently ignoring the keypress.

Fix: When shift is the sole active modifier (no ctrl, no meta), the matcher now also checks the plain key name alongside the "shift+key" form. This means:

  • b with Caps Lock on → emits { name: "b", shift: true } → builds "shift+b", also tries "b" → matches
  • Ctrl+C → still only matches "ctrl+c" (shift fallback only applies when shift is the sole modifier)
  • Explicit "shift+a" bindings still work via exact match on char

Test fix: The existing "handles CAPSLOCK" test was modelling Caps Lock as { name: "A", shift: false } (uppercase name, no shift flag) — but readline actually emits lowercase name with shift: true. Updated to accurately reflect readline's behavior.


  • Tests
    • Tests included/updated
  • Public documentation
    • Documentation not necessary because: this is a bug fix with no user-facing API changes — the hotkeys just work correctly now

Copilot AI review requested due to automatic review settings May 6, 2026 22:07
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

🦋 Changeset detected

Latest commit: 81abf63

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

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

@workers-devprod workers-devprod requested review from a team and edmundhung and removed request for a team May 6, 2026 22:08
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented May 6, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Wrangler dev-server hotkey matching when Caps Lock is enabled by accommodating Node.js readline’s { name: "x", shift: true } emission pattern, and updates tests/changeset accordingly.

Changes:

  • Add a Shift-only normalization fallback so plain hotkeys (e.g. "b") still match when readline reports shift: true with a lowercase name.
  • Update the Caps Lock test fixture to reflect actual readline key event shape and add coverage for ctrl/meta + shift behavior.
  • Add a patch changeset documenting the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/wrangler/src/cli-hotkeys.ts Adds Shift-only fallback matching to make Caps Lock hotkeys work.
packages/wrangler/src/tests/cli-hotkeys.test.ts Updates Caps Lock modeling and adds related regression tests.
.changeset/fix-hotkeys-case-insensitive.md Documents the behavior change as a patch release note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/wrangler/src/cli-hotkeys.ts Outdated
@matingathani
Copy link
Copy Markdown
Contributor Author

@NuroDev @penalosa @dario-piotrowicz — all Copilot review comments have been addressed. This PR is ready for review.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 8, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13834

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13834

miniflare

npm i https://pkg.pr.new/miniflare@13834

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13834

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13834

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13834

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13834

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13834

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13834

wrangler

npm i https://pkg.pr.new/wrangler@13834

commit: 81abf63

Copy link
Copy Markdown
Member

@edmundhung edmundhung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix :)

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk May 8, 2026
@edmundhung edmundhung enabled auto-merge (squash) May 11, 2026 09:58
@edmundhung edmundhung disabled auto-merge May 11, 2026 09:58
@edmundhung edmundhung merged commit a9e6741 into cloudflare:main May 13, 2026
71 of 73 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk May 13, 2026
petebacondarwin pushed a commit to timoconnellaus/workers-sdk that referenced this pull request May 13, 2026
Co-authored-by: Edmund Hung <edmund@cloudflare.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Wrangler hotkeys are case sensitive

4 participants