-
-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(input): correct caps lock indicator state (@VardanRattan) #7477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(input): correct caps lock indicator state (@VardanRattan) #7477
Conversation
|
This is what we originally used, but it caused the Caps Lock warning to be stuck on Linux (see 64a0bdc). |
|
@Leonabcd123 Thanks for pointing that out — I looked into the Linux issue from #7195. From what I can tell, the problem there was related to modifier state not being updated at the time the handler ran, causing the warning to remain visible until a subsequent key event. In this change, the Caps Lock state is still derived from getModifierState("CapsLock"), but the update runs on keyup for all platforms (and additionally on keydown for macOS), which should allow the modifier state to settle correctly on Linux before being read. I agree the toggle workaround avoided the Linux timing issue, but it also caused desynchronization when Caps Lock was already enabled on page load. If there’s a specific Linux scenario where keyup still isn’t sufficient, I’m happy to adjust the event handling further without reintroducing internal toggling. |
|
With this the caps lock warning persists when pressing caps lock on linux |
|
@fehmer Thanks for testing — that makes sense. |
|
Hi @VardanRattan , i checked the latest change, caps lock is still stuck on linux. |
|
Thanks for checking. Could you share how you tested this on Linux? That’ll help narrow down whether this is the same modifier-timing issue as #7195 or a different edge case. |
|
ubuntu 25.10, gnome, wayland |
|
Thanks — that helps a lot. Ubuntu + GNOME + Wayland + Chrome is consistent with the Linux modifier-timing issue from #7195. In that setup, getModifierState("CapsLock") can still return the previous state at the time the CapsLock key event fires, which can leave the warning stuck until another key event. I’ll adjust the Linux handling so the CapsLock modifier read is deferred for CapsLock events, allowing the modifier state to settle before updating visibility. That should clear the warning immediately on toggle without relying on state inversion. I’ll update the PR shortly. |
|
HI @VardanRattan i checked the latest changes and it is still stuck. I think #7478 is the better approach |
|
@fehmer Thanks for re-testing and confirming. If #7478 behaves correctly on Ubuntu + GNOME + Wayland + Chrome, I’m good with going that route for now. My intent here was to avoid state inversion by deferring the modifier read, but I agree practical correctness on Linux is the priority. Happy to close this PR or rebase it later if needed. |
Description
Fixes an issue where the Caps Lock indicator could become inverted if the page was opened while Caps Lock was already enabled.
Previously, the Caps Lock state was toggled internally on
CapsLockkey events, which caused incorrect initialization and desynchronization from the actual OS modifier state. This change removes the toggle-based logic and derives the Caps Lock state exclusively fromKeyboardEvent.getModifierState("CapsLock"), ensuring the indicator always reflects the real modifier state after the first key event.Checks
packages/schemas/src/languages.tsfrontend/src/ts/constants/languages.tsfrontend/static/languagespackages/schemas/src/themes.tsfrontend/src/ts/constants/themes.tsfrontend/static/themespackages/schemas/src/layouts.tsfrontend/static/layoutsfrontend/static/webfontspackages/schemas/src/fonts.tsfrontend/src/ts/constants/fonts.tsCloses #7472 and #5181