Skip to content

TT-7621 fix: act on a segment click instead of swallowing it - #528

Open
nabalone wants to merge 2 commits into
developfrom
TT-7621_pbt-segment-click-not-swallowed
Open

TT-7621 fix: act on a segment click instead of swallowing it#528
nabalone wants to merge 2 commits into
developfrom
TT-7621_pbt-segment-click-not-swallowed

Conversation

@nabalone

@nabalone nabalone commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Fix 2 of the PBT series. Into #527.

The fault

Clicking the segment immediately after the current one sometimes failed to fully change the selected segment, so a take recorded then went to the old segment.

After a segment finishes playing, handleRegionPlayEnd parks and arms pendingOvershootSwallowRef, because playback overshoot into the next region produces a spurious +1 segment change that would otherwise read as navigation (TT-7360). The swallow cannot tell that change apart from the user clicking the next segment, so it ate both.

The fix

The waveform now reports a click distinctly: useWavesurferRegions fires onRegionClicked from handleRegionClick, threaded up through useWaveSurferWSAudioPlayerPassageDetailPlayer as onSegmentClick. A click is deliberate and therefore never overshoot, so the step disarms the swallow when one arrives. Playhead-driven selection still flows through onCurrentRegion unchanged — which is what the swallow exists for.

Additive throughout: every layer takes an optional callback, so other players are unaffected.

Result

Two reported behaviours fixed — the ignored first click, and the waveform selection disagreeing with the segment label (the same swallowed click from the other side). Both tests renamed to what they now assert.

  • selection spec: 6 passing / 1 failing (the remaining failure is Record operable during playback, a separate fix)
  • behaviour specs: 13 + 16 green
  • jest WSAudioPlayer / MediaRecord / PassageDetailCarefulSpeech: 41 green

🤖 Generated with Claude Code

@nabalone
nabalone marked this pull request as ready for review August 24, 2026 13:17
@nabalone
nabalone force-pushed the TT-7621_pbt-segment-selection-and-recorder-state branch from 5bef41e to 3f3ee57 Compare August 24, 2026 21:56
@nabalone
nabalone force-pushed the TT-7621_pbt-segment-click-not-swallowed branch from 8f02f20 to 83fb394 Compare August 24, 2026 21:57
Base automatically changed from TT-7621_pbt-segment-selection-and-recorder-state to develop August 24, 2026 22:33
Clicking the segment immediately after the current one did nothing: the playhead
snapped back, the label never changed, and the user had to click again. Record
also stayed enabled for the segment they were leaving, so a take recorded then
went to the old segment.

After a segment finishes playing, handleRegionPlayEnd parks and arms
pendingOvershootSwallowRef, because playback overshoot into the next region
produces a spurious +1 segment change that would otherwise read as navigation
(TT-7360). The swallow cannot tell that change apart from the user clicking the
next segment, so it ate both.

The waveform now reports a click distinctly: useWavesurferRegions fires
onRegionClicked from handleRegionClick, threaded up through useWaveSurfer,
WSAudioPlayer and PassageDetailPlayer as onSegmentClick. A click is deliberate
and so can never be overshoot, so the step disarms the swallow when one arrives.
Playhead-driven selection still flows through onCurrentRegion exactly as before,
which is what the swallow is there for.

Fixes two of the reported behaviours: the ignored first click, and the waveform
selection disagreeing with the segment label (the same swallowed click, seen
from the other side). Both tests are renamed to what they now assert.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This change only stops a segment click being swallowed. Two other defects
the same spec covers - Record staying operable while a clicked segment
plays, and the waveform selection disagreeing with the segment label -
are fixed separately, but their @known-defect tags had been dropped along
with the one that is fixed here. CI runs cy:run-ct with
grepTags=-@known-defect, so both went red.

Restore the tags and the original names on those two, leaving only the
click-swallow test in the default run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant