Skip to content
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

Show "CapsLock On" text when CapsLock is on #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

justingolden21
Copy link

Will show "CapsLock On" text in the top right UI when caps lock is on

image

There seems to be no way to detect this on load, but $event.getModifierState('CapsLock') seems to work when adding to document:keydown. When hitting any letter or the CapsLock itself, the correct state is added.

I tried to mimic the coding style of some other merged PRs and keep the aesthetic similar with the colors, padding, and right margin, but feel free to let me know if there's something you'd like updated.

Resolves #120

@justingolden21
Copy link
Author

Is this repo still taking pull requests?

Let me know if there's anything you'd like me to update or fix.

@Yqnn
Copy link
Owner

Yqnn commented Apr 14, 2024

Thanks for the contribution 👍
I may accept PRs, but my bandwidth is very low, so it could take a long time 😓.

As far as I know, there is no way to detect reliably if CapsLock is on in a browser: what you did only detects that the button has been pressed, it doesn't detect when CapsLocks is turned off (not immediately) or if CapLocks is turned on outside the browser window.
And showing it isn't really helpful, as the user may not know what it changes.

Instead I would rather show a toast message giving feedback about the action that has just been perform.
Example:

  • L: L command appended
  • ⇧L: selected command converted to L
  • ⇧L: unable to convert selected command to L (no command selected)
  • ␛: command insertion cancelled

@justingolden21
Copy link
Author

All good on the bandwidth, don't stress it 😁

And yeah it can't detect on load, but any time any key at all is pressed, it will get the correct value, even if they press caps lock in another tab or elsewhere. But it only runs when they hit a key in this app.

I think you know best for the UX for your app, so a toast message seems fine as well. I simply think something should be done UX wise as it's rather confusing if you don't know caps is on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI difference when caps key active
2 participants