Fix the visible-keys plugin (keyup crash + missing stylesheet)#7
Merged
Conversation
This was referenced Jun 10, 2026
Pressing a watched key threw `ReferenceError: label is not defined` (label was never declared), and even past that it referenced `key` — the out-of-scope `for…in` loop variable — to animate and remove the indicator. Declare `label`, and capture the inserted <kbd> element so the fade-out and removal target it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
visible-keys/plugin.css styles the `kbd.visible-key` indicator, but the plugin didn't export `hasCSS`, so the core loader — which injects plugin.css only when `module.hasCSS` is truthy — skipped it and the indicator was unstyled. Export hasCSS = true. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b3ac393 to
019bb32
Compare
LeaVerou
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs in the visible-keys plugin, both meaning the indicator never actually appeared.
Crash on keypress
The keyup handler did
label = …(undeclared →ReferenceError: label is not defined) and then referencedkey— the out-of-scopefor…inloop variable — to animate/remove the indicator. So pressing a watched key threw, and no<kbd>was shown. Declarelabel, and capture the inserted<kbd>element for the fade-out and removal.Stylesheet never loaded
visible-keys/plugin.cssstyles thekbd.visible-keyindicator, but the plugin didn'texport const hasCSS = true, so the core loader skipped it. Added the export.Verified (Playwright)
Pressing a watched key now creates the styled
<kbd>indicator (was aReferenceErrorwith no element); core injects<link id="plugin-css-visible-keys">.Related
Same missing-
hasCSSbug, fixed per-plugin: timer (#5), resolution (#6).🤖 Generated with Claude Code