Vansh Malhotra has uploaded the change for review![Open in Gerrit]()
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 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 GerritRelated details
Attention set is empty
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8e258102d1c57cda51b97cc34cb4c8d2762a38d2
Gerrit-Change-Number: 7235725
Gerrit-PatchSet: 1