Skip to content

Field of View: address PR review feedback#19

Merged
acrosman merged 3 commits intofeature/field-of-view-gamefrom
copilot/sub-pr-15
Mar 22, 2026
Merged

Field of View: address PR review feedback#19
acrosman merged 3 commits intofeature/field-of-view-gamefrom
copilot/sub-pr-15

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

Applies all actionable feedback from the Field of View game PR review. Image compression is excluded (handled separately).

Bug fixes

  • stop() no longer calls saveProgress() when trialsCompleted === 0, preventing phantom session increments and stale lastPlayed timestamps on idle stops
  • initGame() replaces the === 3 literal with Number.isFinite + Math.round + Math.max(1, …) validation for downAfterSuccesses, and applies clamp()-based validation to stepUpMs/stepDownMs

Module split (index.js 831 → ~593 lines)

Extracted three focused modules from the monolithic controller:

  • audio.js — shared AudioContext lifecycle; getAudioContext() creates once, playFeedbackSound() resumes a suspended context instead of constructing a new AudioContext per trial
  • render.js — pure rendering utilities (percent, formatMs, labelForIcon, createStimulusImage, buildTrendPolylinePoints, stat/chart/selection helpers)
  • progress.js — IPC-based progress persistence

Accessibility & correctness

  • Grid cell buttons now carry aria-label="Row N, column M" for screen reader targeting
  • manifest.json description updated to match actual assets (kittens/toys, not shapes/stars)
  • app/index.html <title> aligned with visible heading: Brain Speed Exercises
  • interface.html kitten response images get loading="lazy" decoding="async"
  • The kitten response buttons remain visible throughout gameplay to prevent layout shifts; they are only hidden when resetting to the instructions screen

Test coverage

Added audio.test.js, render.test.js, and progress.test.js for the new modules; gameCard.test.js import moved to file top with loose it() calls consolidated into the describe block; index.test.js mocks audio.js and progress.js to isolate the controller.


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…labels, audio context, game logic validation

Co-authored-by: acrosman <2972053+acrosman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/acrosman/BrainSpeedExercises/sessions/550ed7f7-9f1e-42b0-91bb-31cec38618ae
Copilot AI changed the title [WIP] Add field of view game plugin Field of View: address PR review feedback Mar 22, 2026
Copilot AI requested a review from acrosman March 22, 2026 19:14
@acrosman
Copy link
Copy Markdown
Owner

@copilot The adjustment made to hide the kitten buttons is wrong. You were instructed to ignore that feedback because it causes the game play area to move when the buttons appear and disappear. Revert this behavior so the buttons always show. The game play area should not move unless the window is being resized.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot The adjustment made to hide the kitten buttons is wrong. You were instructed to ignore that feedback because it causes the game play area to move when the buttons appear and disappear. Rever...

Fixed in commit c97d669. The kitten response buttons (#fov-response) are now shown once when gameplay starts and remain visible throughout the entire session — they're only hidden again when the game resets to the instructions screen. The per-trial hide/show logic has been removed from runStimulusPhase(), enterResponsePhase(), and submitResponse().

@acrosman acrosman marked this pull request as ready for review March 22, 2026 20:09
@acrosman acrosman merged commit 49fc198 into feature/field-of-view-game Mar 22, 2026
@acrosman acrosman deleted the copilot/sub-pr-15 branch March 22, 2026 20:09
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.

2 participants