monkeytype icon indicating copy to clipboard operation
monkeytype copied to clipboard

fix(caps-warning): prevent shift key from toggling warning (@dimssu)

Open dimssu opened this issue 4 weeks ago • 3 comments

…(@dimssu)

Description

This PR fixes issue #7249 where pressing the Shift key was incorrectly toggling the Caps Lock warning.

Changes

  • Modified caps-warning.ts to ignore modifier keys (except CapsLock itself) to prevent false toggles
  • Updated layout-emulator.ts to get Caps Lock state directly from the event for better accuracy

Testing

  • Verified that pressing Shift no longer toggles the Caps Lock warning
  • Confirmed that actual Caps Lock key still works correctly
  • Tested on both Mac and non-Mac systems

Fixes #7249

Checks

  • [ ] Adding/modifying Typescript code?
    • [ ] I have used qs,qsa or qsr instead of JQuery selectors.
  • [ ] Adding quotes?
    • [ ] Make sure to include translations for the quotes in the description (or another comment) so we can verify their content.
  • [ ] Adding a language?
    • Make sure to follow the languages documentation
    • [ ] Add language to packages/schemas/src/languages.ts
    • [ ] Add language to exactly one group in frontend/src/ts/constants/languages.ts
    • [ ] Add language json file to frontend/static/languages
  • [ ] Adding a theme?
    • Make sure to follow the themes documentation
    • [ ] Add theme to packages/schemas/src/themes.ts
    • [ ] Add theme to frontend/src/ts/constants/themes.ts
    • [ ] Add theme css file to frontend/static/themes
    • [ ] Add some screenshot of the theme, especially with different test settings (colorful, flip colors) to your pull request
  • [ ] Adding a layout?
    • [ ] Make sure to follow the layouts documentation
    • [ ] Add layout to packages/schemas/src/layouts.ts
    • [ ] Add layout json file to frontend/static/layouts
  • [ ] Adding a font?
    • Make sure to follow the themes documentation
    • [ ] Add font file to frontend/static/webfonts
    • [ ] Add font to packages/schemas/src/fonts.ts
    • [ ] Add font to frontend/src/ts/constants/fonts.ts
  • [ ] Check if any open issues are related to this PR; if so, be sure to tag them below.
  • [ ] Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • [ ] Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.

Closes #7249

dimssu avatar Dec 15 '25 21:12 dimssu

How did you reproduce the bug? I don't get any warning when pressing shift.

Leonabcd123 avatar Dec 16 '25 10:12 Leonabcd123

How did you reproduce the bug? I don't get any warning when pressing shift.

@Leonabcd123 I could only reproduce this error on Windows as on Mac shiift does not cancels the Caps Lock when Caps Lock is ON.

And on windows when the Caps Lock was on and I was typing with my shift button pressed, so even when the typed letter was in lowercase the UI still showed that the typed letter is wrong

dimssu avatar Dec 16 '25 23:12 dimssu

What you're describing isn't the bug you're trying to fix. The bug (which is closed, as the cause was a problem in the input setup of the reporter), is that pressing shift causes the caps lock notification to show. it has nothing to do with pressing both shift and caps lock.

Leonabcd123 avatar Dec 17 '25 07:12 Leonabcd123