Skip to content

Debounce dropdown/accordion arrow toggle mid-animation (#1012)#1263

Open
IshanA2007 wants to merge 1 commit into
devfrom
1012-dropdown-arrow-debounce
Open

Debounce dropdown/accordion arrow toggle mid-animation (#1012)#1263
IshanA2007 wants to merge 1 commit into
devfrom
1012-dropdown-arrow-debounce

Conversation

@IshanA2007

Copy link
Copy Markdown
Collaborator

Closes #1012

Problem

Rapidly clicking a dropdown/accordion header flipped the chevron arrow inconsistently — a second click landed mid-transition (the chevron animates ~200ms via --duration-normal) while the handler did a bare classList.toggle('is-open') with no guard, leaving the arrow out of sync with the open/closed state.

Fix

Added an is-animating lockout to the browse-page school accordion (tcf_website/templates/site/catalog/browse.html): clicks are ignored while the chevron transition is in flight, released on the chevron's transitionend (transform) with a 300ms setTimeout fallback for prefers-reduced-motion/zero-duration cases. Keyboard/Enter activation is preserved; no new libraries.

Scope note

The FAQ accordion named in the original report was removed in the v2 UI rewrite. I audited every rotate(180deg) arrow in the codebase — the browse school accordion is the only live, JS-driven toggle with this race. Intentionally left alone: the header user-menu / recent-items dropdowns (popovers that legitimately close on re-click), native <details>/<summary> elements (rotation driven by the browser, not JS), and the .accordion__* CSS (dead after the v2 rewrite).

Verification

  • Static trace: rapid second click hits the animating guard and is ignored until the chevron settles; single-click and keyboard activation are unaffected; the fallback timer guarantees the lock always clears (no deadlock).
  • Node --check syntax validation of the inline JS block passed.
  • No headless-browser run (JS is inline in a Django template) — runtime behavior confirmed by static reasoning.

Caveat

.school-header is a <div> with no tabindex/role today, so it isn't keyboard-focusable — a pre-existing a11y gap left unchanged (out of scope for this fix).


🤖 Implemented with Claude Code.

The school-header chevron on the browse page animates via
`transition: transform var(--duration-normal)` (~200ms). The click
handler did a naked `classList.toggle('is-open')`, so rapid clicks
re-toggled the class before the transform finished, leaving the arrow
flipped inconsistently relative to its animation.

Guard the toggle with an `is-animating` lock: ignore clicks while the
chevron transition is in flight, clearing the lock on the chevron's
`transitionend` (transform) event with a 300ms time-based fallback for
cases where the event never fires (reduced motion, zero-duration, or an
off-screen element). Keyboard/Enter activation is unaffected since it
dispatches the same guarded click handler.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@IshanA2007, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28893c6c-16f3-4a54-a3ef-1957395d4e6a

📥 Commits

Reviewing files that changed from the base of the PR and between ed955fb and 07c1af8.

📒 Files selected for processing (1)
  • tcf_website/templates/site/catalog/browse.html
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1012-dropdown-arrow-debounce

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@IshanA2007
IshanA2007 marked this pull request as ready for review July 8, 2026 18:53
@IshanA2007 IshanA2007 self-assigned this Jul 8, 2026
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.

Dropdown arrow switching issue

1 participant