File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,6 +171,17 @@ describe("makeQuitHoldHandler", () => {
171171 expect ( harness . quit ) . not . toHaveBeenCalled ( ) ;
172172 } ) ;
173173
174+ it ( "does not count an interrupted press toward a double tap" , async ( ) => {
175+ const harness = makeHarness ( ) ;
176+ await harness . send ( makeInput ( { } ) ) ;
177+ await harness . send ( makeInput ( { shift : true } ) ) ;
178+ // A fresh press right after the interruption starts a new hold, not a
179+ // double-tap quit.
180+ await harness . send ( makeInput ( { } ) ) ;
181+ expect ( harness . quit ) . not . toHaveBeenCalled ( ) ;
182+ expect ( harness . notifications ) . toEqual ( [ "down" , "up" , "down" ] ) ;
183+ } ) ;
184+
174185 it ( "ignores other shortcuts" , async ( ) => {
175186 const harness = makeHarness ( ) ;
176187 await harness . send ( makeInput ( { key : "w" } ) ) ;
Original file line number Diff line number Diff line change @@ -86,8 +86,14 @@ export function makeQuitHoldHandler(
8686 if ( ! modifierDown || input . alt || input . shift || key !== "q" ) {
8787 // Any other key (or an extra modifier) pressed mid-hold breaks the
8888 // gesture; without this the hold timer keeps running through the
89- // interruption and the next qualifying repeat would quit early.
90- if ( holding && ! input . isAutoRepeat ) release ( ) ;
89+ // interruption and the next qualifying repeat would quit early. The
90+ // interrupted press also stops counting toward a double tap — but only
91+ // here, not in release(), which runs mid-restart on an unseen-release
92+ // re-press and must not wipe that press's own tap timestamp.
93+ if ( holding && ! input . isAutoRepeat ) {
94+ lastPressAt = 0 ;
95+ release ( ) ;
96+ }
9197 return ;
9298 }
9399
You can’t perform that action at this time.
0 commit comments