Skip to content

Commit d08abf5

Browse files
GilbNclaude
andcommitted
Fix reshoot state-machine corruption and PeerList modal a11y
- TimerScheduler: preserve pre-reshoot stoppedReason across reshoot runs so nextSeries()/restartSeries() resume correctly instead of treating the reshoot as a manual abort (which skipped a series when reshooting between series or from idle). - PeerList: drop panel onkeydown stopPropagation so Escape reaches the document listener when focus is inside the dialog. - PeerList: add aria-labelledby linking the panel to the <h2> title for screen-reader dialog naming. - registry: restore DEFAULT_LOADING_TIME to 60s and fix comment typo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c6f5a51 commit d08abf5

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/components/PeerList.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
</script>
1616

1717
<div class="modal-backdrop" role="presentation" onclick={onClose}>
18-
<div class="modal-panel" role="dialog" aria-modal="true" tabindex="-1" onclick={(e) => e.stopPropagation()} onkeydown={(e) => e.stopPropagation()}>
18+
<div class="modal-panel" role="dialog" aria-modal="true" aria-labelledby="peer-list-title" tabindex="-1" onclick={(e) => e.stopPropagation()}>
1919
<div class="modal-header">
20-
<h2 class="modal-title">{$t('shooters')}</h2>
20+
<h2 id="peer-list-title" class="modal-title">{$t('shooters')}</h2>
2121
<span class="peer-count">{peers.length}</span>
2222
</div>
2323

src/lib/programs/registry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
import { loadCustomPrograms } from '../storage'
99

10-
const DEFAULT_LOADING_TIME = 6
10+
const DEFAULT_LOADING_TIME = 60
1111
const DEFAULT_TARGET_HIDDEN_TIME = 7
1212
const DEFAULT_TARGET_VISIBLE_TIME_DUEL = 3
13-
const TARGET_DISPLAY_TIME_OFFSET_DUEL = 0.29 // At the range the target uses .29 seconds to transition between hidden and visible, so this needs to be added to the visible time to get the correct timing for when the target is fully
13+
const TARGET_DISPLAY_TIME_OFFSET_DUEL = 0.29 // At the range the target uses .29 seconds to transition between hidden and visible, so this needs to be added to the visible time to get the correct timing for when the target is fully visible
1414

1515
export const programs = [
1616
{

src/lib/timer/TimerScheduler.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ export class TimerScheduler {
251251
this.engine.stop()
252252
this._clearDuelTimer()
253253

254+
// Stash the pre-reshoot stoppedReason so nextSeries()/restartSeries()
255+
// can resume correctly after the reshoot completes.
256+
this._preReshootStoppedReason = this.state.stoppedReason ?? null
257+
254258
const loadingMs = (exercise.loadingTime || 60) * 1000
255259
this._updateState({
256260
phase: 'loading',
@@ -392,13 +396,18 @@ export class TimerScheduler {
392396
const wasReshoot = this.state.isReshoot
393397

394398
if (wasReshoot) {
399+
// Restore the pre-reshoot stoppedReason so the series state-machine
400+
// (nextSeries/restartSeries) picks up where it left off rather than
401+
// treating the reshoot as a manual abort.
402+
const restoredReason = this._preReshootStoppedReason ?? null
403+
this._preReshootStoppedReason = null
395404
this._updateState({
396405
phase: 'stopped',
397406
remainingMs: 0,
398407
targetVisible: false,
399408
isReshoot: false,
400409
reshootPeerName: null,
401-
stoppedReason: 'aborted',
410+
stoppedReason: restoredReason,
402411
})
403412
return
404413
}

0 commit comments

Comments
 (0)