# Issue with calling runScopeHandlers with ctrl+shift

**URL:** <https://discuss.codemirror.net/t/issue-with-calling-runscopehandlers-with-ctrl-shift/9668>\
**Category:** v6\
**Created:** [February 3, 2026, 9:51pm UTC](https://discuss.codemirror.net/t/issue-with-calling-runscopehandlers-with-ctrl-shift/9668 "2026-02-03T21:51:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lvrpl](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/lvrpl/32/5299_2.png) [@lvrpl](https://discuss.codemirror.net/u/lvrpl)\
**Post date:** [February 3, 2026, 9:51pm UTC](https://discuss.codemirror.net/t/issue-with-calling-runscopehandlers-with-ctrl-shift/9668/1 "2026-02-03T21:51:35Z")

</div>

I have created a search panel with an input. I feed the keyboard events from that input into the CodeMirror view with runScopeHandlers.

I have key bindings:

- Mod+Shift+h for replaceAll
- Mod+h for replaceNext

While my search panel input has focus, Mod+Shift+h will call replaceAll just fine. But when I have cap locks on, then Mod+Shift+h will instead call replaceNext. The difference between the two keyboard events is if cap locks is on then key=’h’ instead of ‘H’.

The issue happens in keymap.ts runHandlers line 250…

```typescript
      if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)])) {

```

This is the first runFor check that’s called. The third argument for modifiers says that shift is always false. So when cap locks in ON it’ll return “Ctrl+h” which matches replaceNext exactly and calls that one (which we don’t want). When cap locks is OFF it’ll return “Ctrl+H” which doesn’t match anything, then it’ll fall through and call a runFor that allows the shift modifier.

Not sure what the best fix is here…

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [February 4, 2026, 10:27am UTC](https://discuss.codemirror.net/t/issue-with-calling-runscopehandlers-with-ctrl-shift/9668/2 "2026-02-04T10:27:24Z")

</div>

Which platform are you on? On Linux, Ctrl-h seems to still produce an event with `key` equal to `"h"`, even with Caps Lock on, and I’m seeing the expected key bindings fire.

---

<div class="post-metadata">

**Author:** ![lvrpl](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/lvrpl/32/5299_2.png) [@lvrpl](https://discuss.codemirror.net/u/lvrpl)\
**Post date:** [February 4, 2026, 3:46pm UTC](https://discuss.codemirror.net/t/issue-with-calling-runscopehandlers-with-ctrl-shift/9668/3 "2026-02-04T15:46:03Z")

</div>

I’m on Windows 11 + Chrome

I tested on Firefox too and caplocks will make the key uppercase. Caplocks + shift will make the key lowercase again.

I tested it not in my app, but just adding this in dev tools:  
document.addEventListener(‘keydown’, (e) =\> console.log(e))

---

<div class="post-metadata">

**Author:** ![lvrpl](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/lvrpl/32/5299_2.png) [@lvrpl](https://discuss.codemirror.net/u/lvrpl)\
**Post date:** [February 4, 2026, 3:50pm UTC](https://discuss.codemirror.net/t/issue-with-calling-runscopehandlers-with-ctrl-shift/9668/4 "2026-02-04T15:50:28Z")

</div>

Actually, I’m seeing the problem because the first runFor ignores the shift modifier because of “!isChar”. So even if I presss Ctrl-Shift-h, it looks up the keybinding for Ctrl-h first and finds the wrong command. It just so happens that when caplocks is off it “fixed” the problem because it was trying to look up the keybinding for Ctrl-H and failing to match.
