Skip to content

fix: Fix bug that made some keyboard shortcuts non-idempotent - #10286

Open
gonfunko wants to merge 2 commits into
mainfrom
duplicity
Open

fix: Fix bug that made some keyboard shortcuts non-idempotent#10286
gonfunko wants to merge 2 commits into
mainfrom
duplicity

Conversation

@gonfunko

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes #10250

Proposed Changes

This PR fixes a bug that caused keyboard shortcuts to be run multiple times when a WidgetDiv or DropDownDiv was open. Because the *Divs may live outside of the injection div, they register the global keyboard shortcut handler for their own divs, so that keyboard shortcuts still work when a dropdown or contextual menu is open. However, in the typical case where they do live in the injection div, key events would then bubble up to the main global keyboard shortcut handler and be executed again, which in the particularly case of Duplicate had obvious effects. This PR stops propagation, so that events only get run through the keyboard shortcut handler once.

Test Coverage

All tests pass, and I added a test specifically for this scenario with the WidgetDiv. In principle the problem and fix affect the DropDownDiv too, but Duplicate is the only shortcut with a keybinding that isn't inherently idempotent and isn't also suppressed when ephemeral focus is taken.

@gonfunko
gonfunko requested a review from a team as a code owner August 18, 2026 21:53
@gonfunko
gonfunko requested a review from maribethb August 18, 2026 21:53
@github-actions github-actions Bot added the PR: fix Fixes a bug label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use key "D" shortcut to copy a block when context menu is open makes duplication triggers multiple times

2 participants