Skip to content

fix(behaviors): Ignore masked mods in key repeat - #3437

Open
jjiill888 wants to merge 1 commit into
zmkfirmware:mainfrom
jjiill888:pr/key-repeat-masked-mods
Open

fix(behaviors): Ignore masked mods in key repeat#3437
jjiill888 wants to merge 1 commit into
zmkfirmware:mainfrom
jjiill888:pr/key-repeat-masked-mods

Conversation

@jjiill888

@jjiill888 jjiill888 commented Jul 23, 2026

Copy link
Copy Markdown

When a mod-morph consumes a modifier, it masks it via zmk_hid_masked_modifiers_set() so the morphed keycode is sent without it. The key repeat behavior, however, captured zmk_hid_get_explicit_mods() unfiltered and stored it as implicit modifiers, and implicit modifiers bypass the mask when the HID report is built.

Pressing shift, tapping a mod-morph that morphs to an unshifted keycode (e.g. COMMA -> SEMICOLON), releasing shift and then pressing &key_repeat therefore emitted ':' instead of a second ';'.

Expose the masked modifiers and exclude them when capturing, so only modifiers that actually contributed to the output are repeated.

Fixes #3368

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.
  • Includes any necessary documentation changes.

When a mod-morph consumes a modifier, it masks it via
zmk_hid_masked_modifiers_set() so the morphed keycode is sent without it.
The key repeat behavior, however, captured zmk_hid_get_explicit_mods()
unfiltered and stored it as implicit modifiers, and implicit modifiers
bypass the mask when the HID report is built.

Pressing shift, tapping a mod-morph that morphs to an unshifted keycode
(e.g. COMMA -> SEMICOLON), releasing shift and then pressing &key_repeat
therefore emitted ':' instead of a second ';'.

Expose the masked modifiers and exclude them when capturing, so only
modifiers that actually contributed to the output are repeated.

Fixes zmkfirmware#3368
@jjiill888
jjiill888 requested a review from a team as a code owner July 23, 2026 00:12
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.

&key_repeat does not repeat some mod-morph keys

1 participant