silverbullet icon indicating copy to clipboard operation
silverbullet copied to clipboard

[BUG] Inconsistent shortcut handling: Ctrl-Alt-u vs Ctrl-Alt-U + CapsLock interaction

Open CozmoCyke opened this issue 1 month ago • 2 comments

Hi all, I found a very weird but 100% reproducible issue with keyboard shortcuts in SilverBullet. It explains many problems I had with commands not firing.

✔️ Summary

The case of the letter in the key = "..." shortcut definition changes whether Shift becomes required. This creates inconsistent behavior depending on CapsLock and implicit Shift.

✔️ Reproduction Case 1: key = "Ctrl-Alt-u"

→ Works when pressing Ctrl+Alt+u → Does not work when CapsLock is ON → Does not work with Ctrl+Alt+Shift+u (acts like shiftKey must be false)

Case 2: key = "Ctrl-Alt-U"

→ Works only with Ctrl+Alt+Shift+u → Also works when CapsLock is ON → Does NOT work with simple Ctrl+Alt+u (acts like shiftKey must be true)

✔️ Interpretation

It seems SilverBullet treats the case of the letter as:

lowercase → requires shiftKey = false

uppercase → requires shiftKey = true

But CapsLock produces shiftKey = true on the event, leading to invisible, surprising behavior.

✔️ Why this matters

Users may define shortcuts with U instead of u without realizing they implicitly required Shift. This is very confusing because the UI does not warn about this difference, and the keyboard does not allow typing “lowercase U” with Shift.

✔️ Expected behavior

Letter case in the shortcut definition should not affect modifier requirements. Only explicit modifiers (Ctrl, Alt, Shift) should matter.

✔️ Suggested fix

Normalize shortcut keys to lowercase and ignore letter case when parsing. Use only declared modifiers.

Thanks! This will help avoid many misunderstandings with shortcuts. I’m available to test any fix or PR.

CozmoCyke avatar Nov 25 '25 00:11 CozmoCyke

What OS and browser are you using? This is what I tried on macOS Firefox and Chrome and both work correctly (all ignore caps lock):

  • Ctrl-Alt-q
  • Ctrl-Alt-Shift-q (works with capital Q)
  • Ctrl-Alt-Q (works with capital Q)

zefhemel avatar Nov 25 '25 13:11 zefhemel

Relavent: https://github.com/silverbulletmd/silverbullet/issues/1530 = https://community.silverbullet.md/t/capslock-shortcut-keys-containing-letter-fail/3194

reproducible on Windows

ChenZhu-Xie avatar Dec 01 '25 09:12 ChenZhu-Xie