[Blink][Input] Normalize alphabetic KeyboardEvent.key for control shortcut s This change ensures that when Ctrl+Shift+<letter> is pressed, KeyboardEvent.key still exposes a lowercase alphabetic value (e.g. "j"), so shortcut handlers that compare against lowercase keys continue to match. [chromium/src : main]

0 views
Skip to first unread message

Vansh Malhotra (Gerrit)

unread,
Dec 6, 2025, 4:33:22 PM (yesterday) Dec 6
to blink-...@chromium.org

Vansh Malhotra has uploaded the change for review

Commit message

[Blink][Input] Normalize alphabetic KeyboardEvent.key for control shortcut
s
This change ensures that when Ctrl+Shift+<letter> is pressed,
KeyboardEvent.key still exposes a lowercase alphabetic value (e.g. "j"),
so shortcut handlers that compare against lowercase keys continue to match.

Rationale
=========
Previously Chrome reported an uppercase letter for Ctrl+Shift+<letter> (e.g. "J"),
which caused common shortcut-detection code comparing against lowercase letters
to fail. This behavior was inconsistent with Firefox/Safari and the expectations
of the KeyboardEvent.key specification. Normalizing alphabetic keys to lowercase
when Control is held restores expected behavior and avoids breaking existing web
apps.

What was changed
================
- In the KeyboardEvent constructor, when the DOM key string is a single ASCII
letter and the Control modifier is present, convert it to lowercase.
- Minor style cleanup (consistent braces) to avoid accidental fall-throughs.

Testing
=======
Manual:
- Built Chromium locally and verified:
* Ctrl+J → handler triggers.
* Ctrl+Shift+J → handler also triggers when comparing against "j".
* DevTools logs `key: "j"` for Ctrl+Shift+J.
Bug: 466231440
Change-Id: I8e258102d1c57cda51b97cc34cb4c8d2762a38d2

Change diff


Change information

Files:
  • M README.md
  • M third_party/blink/renderer/core/events/keyboard_event.cc
Change size: M
Delta: 2 files changed, 47 insertions(+), 14 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8e258102d1c57cda51b97cc34cb4c8d2762a38d2
Gerrit-Change-Number: 7235725
Gerrit-PatchSet: 1
Gerrit-Owner: Vansh Malhotra <vansh.ma...@gmail.com>
Gerrit-Reviewer: Vansh Malhotra <vansh.ma...@gmail.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages