Skip to content

Two shortcuts on the same key silently resolve instead of failing #332

Closed

Description

@imshashank

Found while reviewing #331, which bound shift+d to the theme toggle without noticing that issue-properties.tsx already binds it to the due date menu.

What happens

selectMatch in apps/web/src/lib/keyboard/registry.ts resolves a pressed binding by walking every registered entry and keeping the best one, where beats() compares step count, then priority, then shift specificity. When two entries tie on all three, beats() returns false and the winner is simply whichever entry the registry happened to see first.

That is a silent resolution, not an error. Nothing warns, nothing fails, and the losing shortcut just stops working. In #331's case the command palette registers on shell mount, before any issue page, so the global theme toggle would have shadowed a surface shortcut that the UI actively advertises through <PropertyRow shortcut="shift+d">.

It is also invisible to review. The PR was small, well tested and correctly documented, and the collision was still only caught by reading every other useHotkey call in the app.

What to build

A duplicate detection that fails rather than resolves. Two reasonable shapes, either is fine:

  • A test that builds the full registry the way the app does and asserts no two advertised entries share a binding within a scope that can be active at the same time.
  • A development mode warning from HotkeyRegistry.register when an incoming entry ties an existing one on all three tiebreakers, since a genuine tie means neither author knew about the other.

The test is probably the better first step because it runs in CI and cannot be ignored.

Also worth doing

docs/keyboard-shortcuts.md uses useHotkey('shift+d', duplicateIssue, ...) as its worked example in the "Adding one" section, while shift+d is really the due date menu. Pick a key for that example that is not bound to anything, so the documentation cannot drift into describing a real conflict.

Related: #130, #331.

Activity

  1. added
    bug
    good first issue
    help wanted
    p2 medium
    area: web
    size: small
    points: 2
    on Aug 18, 2026
  2. Alwaz1143 commented on Aug 18, 2026

    @Alwaz1143

    Hi! I'd like to work on this issue. I can take the test-first approach mentioned in the description, including adding collision detection for conflicting shortcuts and updating the documentation example. Is it okay if I take this one?

  3. added 2 commits that reference this issue on Aug 18, 2026
    a22b17d
    ac0b21f
  4. added a commit that references this issue on Aug 19, 2026
    aa3e922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: webbuggood first issuehelp wantedp2 mediumpoints: 2size: small

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions