Skip to content

Hide next GP button on reset#15

Open
DaKongOlta wants to merge 1 commit into
mainfrom
codex/add-visibility-logic-for-gp-button
Open

Hide next GP button on reset#15
DaKongOlta wants to merge 1 commit into
mainfrom
codex/add-visibility-logic-for-gp-button

Conversation

@DaKongOlta

@DaKongOlta DaKongOlta commented Feb 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • hide the next GP race button whenever race controls reset so it does not linger
  • ensure the button toggles aria-hidden state consistently when shown or hidden

Testing

  • not run (not requested)

Codex Task

Summary by Sourcery

Ensure the Next GP race button is consistently hidden and marked aria-hidden when race controls or results are reset, and correctly exposed when the next race becomes available.

Bug Fixes:

  • Hide the Next GP race button whenever race controls or results are reset so it does not remain visible unexpectedly.
  • Keep the Next GP race button’s aria-hidden attribute in sync with its visibility when showing, hiding, and on click.

@sourcery-ai

sourcery-ai Bot commented Feb 17, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR ensures the "next GP race" button is consistently hidden and marked aria-hidden whenever race controls are reset or the button is programmatically hidden, and that it is explicitly marked aria-visible when shown after a GP race, improving both visual and accessibility state synchronization.

Sequence diagram for next GP race button visibility and accessibility state

sequenceDiagram
  actor User
  participant RaceEngine
  participant RaceControls
  participant NextRaceButton

  User->>RaceEngine: CompleteGrandPrixRace
  RaceEngine->>RaceControls: onGrandPrixRaceFinished
  RaceControls->>NextRaceButton: style.display = inline-block
  RaceControls->>NextRaceButton: setAttribute aria-hidden false

  User->>RaceControls: ResetRaceControls
  RaceControls->>NextRaceButton: style.display = none
  RaceControls->>NextRaceButton: setAttribute aria-hidden true

  User->>NextRaceButton: click
  NextRaceButton->>RaceControls: onNextRaceClicked
  RaceControls->>NextRaceButton: style.display = none
  RaceControls->>NextRaceButton: setAttribute aria-hidden true
  RaceControls->>RaceEngine: prepareGrandPrixRound
  RaceControls->>RaceEngine: startRace
Loading

State diagram for next GP race button visibility and aria-hidden synchronization

stateDiagram-v2
  [*] --> Hidden

  state Hidden {
    [*] --> HiddenState
    state HiddenState {
      [*] --> StableHidden
      StableHidden: style.display = none\naria-hidden = true
    }
  }

  state Visible {
    [*] --> VisibleState
    state VisibleState {
      [*] --> StableVisible
      StableVisible: style.display = inline-block\naria-hidden = false
    }
  }

  Hidden --> Visible: GrandPrixRaceFinished
  Visible --> Hidden: ResetRaceControls
  Visible --> Hidden: NextRaceButtonClicked
  Visible --> Hidden: GrandPrixReset
  Hidden --> Hidden: ReplayRace
  Visible --> Visible: UpdateNextRaceNumber
Loading

File-Level Changes

Change Details Files
Ensure next GP race button is fully hidden (visibility and ARIA) whenever race UI is reset or the button is dismissed.
  • Add guard-blocks that hide the next race button and set aria-hidden="true" in race control reset logic paths
  • Replace one-line next race button hide call with a block that also updates aria-hidden="true"
script.js
Synchronize ARIA visibility with visual display when showing or clicking the next GP race button.
  • When enabling the next race button after a GP race, set aria-hidden="false" in addition to changing display to inline-block
  • On next race button click, hide the button and set aria-hidden="true" before starting the next race
script.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • You’re now repeating the nextRaceBtn hide + aria-hidden logic in several places; consider extracting small helper functions like showNextRaceBtn()/hideNextRaceBtn() to keep the behavior consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You’re now repeating the `nextRaceBtn` hide + `aria-hidden` logic in several places; consider extracting small helper functions like `showNextRaceBtn()`/`hideNextRaceBtn()` to keep the behavior consistent and easier to maintain.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant