fix(go): align deck lock with #deck transition-duration (60ms floor) - #38
Open
raawaa wants to merge 1 commit into
Open
fix(go): align deck lock with #deck transition-duration (60ms floor)#38raawaa wants to merge 1 commit into
raawaa wants to merge 1 commit into
Conversation
This was referenced Jul 1, 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.
Summary
Bug: in static mode (
Bkey), rapid→keypresses are eaten becausego()'s hard-coded 700mslockoutlives the deck's0sCSS transition. Users have to press→twice to advance the slide.Fix: replace the literal
700with adeckLockMs()helper that reads#deck's actual CSStransition-durationand applies a 60ms floor (to block keyboard auto-repeat at ~30ms). The lock now follows the transition in both static and motion modes.Scope: 2 files —
assets/template.html(Style A) andassets/template-swiss.html(Style B). 32 lines added, 2 removed. No other files touched.Repro
assets/template.html(Style A) orassets/template-swiss.html(Style B).Bto enter static mode (body.low-power,transition: none !important).→four times with ~200ms between presses.lockand do nothing. The user has to press→twice to advance the slide. Affects every upstream user who toggles to static mode.Root cause
go(n)has a hard-coded 700mslockat the top:But
#deck's CSStransition-durationis mode-dependent:body.low-power):0s(the transition isnone !important).9s(900ms)The lock and the transition are not aligned. In static mode the 700ms lock outlives the 0ms transition by 700ms, swallowing any rapid follow-up press.
Fix
Read
#deck'stransitionDurationviagetComputedStyle, take the max across comma-separated components, and apply a 60ms floor:In
go(), replacesetTimeout(()=>lock=false, 700)withsetTimeout(()=>lock=false, deckLockMs()). Applied identically toassets/template.htmlandassets/template-swiss.html.Why 60ms floor: blocks keyboard auto-repeat at ~30ms, doesn't block normal human keypress at >120ms.
Why CSS-driven (not
__lowPowerMode-driven): CSS is the single source of truth for transition length. If someone customizes the transition to 600ms or adds awill-change, the lock follows automatically. Reading the JS flag would duplicate config.Evidence
Repro on a 2-slide throwaway deck (served locally, opened in browser). Press
→four times with ~200ms between presses, in both modes.Static mode (B key,
body.low-power):lockand do nothing. The user has to press→twice to advance.Motion mode (default, ~900ms CSS transition):
lock.lock. Behavior preserved — no regression in the default mode.Unit tests for
deckLockMs()(mockedgetComputedStyle):transitionDuration0s(static mode)0.9s(motion mode)900ms0.9s, 0.3s(multi-component)200ms, 0.5s(mixed units)100ms, 200ms, 50ms(ms only)0.25s(float seconds)#deckelement missingAll 8 cases pass.
A manual browser test (in-app browser against the throwaway deck) confirmed: 4 rapid
→presses in static mode all advance; switching back to motion mode preserves the throttle.Notes
__playSliderecipe trigger (if(window.__playSlide) setTimeout(()=>window.__playSlide(idx), 450)) is unchanged. If the transition length is ever customized, that trigger could becometransitionMs / 2— separate concern, out of scope.__lowPowerMode/body.low-powerstill only control visual / animation, not lock timing.references/checklist.mdor any other file; this PR is the minimum surface area for the fix.