Skip to content

fix: keep focus on guild buttons and toast when they're throttled - #1627

Open
raz-iacob wants to merge 1 commit into
dev-null-sh:productionfrom
raz-iacob:fix/guild-buttons-throttle-focus
Open

raz-iacob wants to merge 1 commit into
dev-null-sh:productionfrom
raz-iacob:fix/guild-buttons-throttle-focus

Conversation

@raz-iacob

@raz-iacob raz-iacob commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Join and Mute buttons on the Guilds page and on guild pages had two rough edges:

  • A throttled click opened an error screen. Joining and muting share the follows rate limit. A click over the limit replaced the page with Inertia's error dialog showing the 429 page. Now it shows the usual "Slow down" toast, keeps the page, and the button goes back to how it was, like Who to follow's follow buttons.
  • Keyboard focus was lost. While a request ran, both buttons were disabled, so pressing Enter on Join dropped focus to the page. Now they're aria-disabled and ignore clicks until the request ends, like the star and pastéis buttons. Focus stays on the button, now Leave.

Changes

  • GuildPreferences:
    • passes onHttpException: (response) => !toastWhenThrottled(response);
    • returns early from update while a request is in flight;
    • uses aria-disabled={processing} instead of disabled on both buttons.
  • Two tests in GuildControls.test.tsx: busy buttons stay focusable and send nothing more, and a 429 is handled by the toast while other errors keep the default. Both fail on the old component.

Validation

  • On 5eb634e1 (based on c2eccd80): composer test:lint, test:types and test:type-coverage pass. composer test:unit passes 6,382 Pest tests at 100% coverage, 1,101 component tests and 321 JS tests.
  • Chrome, on /guilds, signed in with guild access:
    • Join while throttled (429 from the server, intercepted): before, the error dialog; after, the toast, with the button back to Join.
    • Tab to Join (or Mute) and press Enter: before, focus falls to the page; after, it stays on the button, now Leave (or Unmute), with its focus ring.
    • While the request runs: before, both buttons dimmed to half opacity; after, they stay as they are.

Visual evidence

Chrome at 2x, /guilds signed in with guild access. Before is production (c2eccd80), after is 5eb634e1.

Join on Coffee while throttled:

Before After
1440×900 light
1440×900 dark
1366×650 light
1366×650 dark
390×844 light
390×844 dark

While the join request is in flight (held open), 1440×900:

Before After
Light
Dark

After pressing Enter on Join:

Before After
1440×900 light
1440×900 dark
1366×650 light
1366×650 dark

Mute, which goes through the same code (a 429 on Mute behaves like Join: before, the error dialog; after, the toast, with the button back to Mute):

Before After
Enter on Mute, dark

Layout shift during the keyboard join: 0 before and after.

Device verification

Phone width was checked with Chrome's mobile emulation only (390×844, touch), not on a physical device or a simulator. Tapping Join while throttled shows the toast above the bottom bar, and the page stays. Keyboard focus doesn't apply to taps, so on phones the visible change is the toast and the button no longer dimming during the request.

Independent review

Reviewed by a separate read-only agent on base c2eccd80, head 5eb634e1, media 3746c7d3: CODE: PASS, VISUAL: PASS. Its first pass asked for captures of the in-flight state, focus at 1366×650, and the Mute button. Those are added above. It also simulated merging this with #1615 and found no conflicts.

Limitations

Summary by CodeRabbit

  • Bug Fixes
    • Prevented duplicate join or mute requests while an update is already in progress.
    • Improved handling of throttled requests and kept controls responsive while showing their busy state.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Guild preference updates now ignore additional requests while processing. The Join and Mute buttons expose their busy state through aria-disabled. The request’s HTTP-exception handler uses toastWhenThrottled to determine its return value.

Changes: Guild preference updates

Layer / File(s) Summary
Pending update controls
resources/js/components/guild-preferences.tsx, tests/Unit/GuildControls.test.tsx
The update handler returns early during processing. The Join and Mute buttons use aria-disabled instead of the native disabled attribute. Tests check that repeated clicks are ignored and the busy state clears when the request finishes.
HTTP exception handling
resources/js/components/guild-preferences.tsx, tests/Unit/GuildControls.test.tsx
The request’s onHttpException callback returns the inverse of toastWhenThrottled. Tests check its result for status 429 and status 500.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: paulinevos

Merge Risk: Minimal · up to 5eb63

Join and Mute buttons now keep keyboard focus while a request is pending, and throttled requests show the usual toast instead of the error dialog. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: keep focus on guild buttons and toast when they're throttled" matches the main change. The PR makes Join and Mute buttons use aria-disabled while a request is in flight, so focus stays…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: keep focus on guild buttons and toast when they're throttled" matches the main change. The PR makes Join and Mute buttons use aria-disabled while a request is in flight, so focus stays on the button. Throttled (429) responses show the 'Slow down' toast instead of Inertia's error dialog. The title names the primary behavior and the affected elements, and it follows a conventional commit prefix. No unrelated changes were described in the summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e240edec-411a-4044-9dfa-3a49b5777391
Commits

Reviewing files that changed from the base of the PR and between c2eccd8 and 5eb634e.

Files selected for processing: 2

  • resources/js/components/guild-preferences.tsx
  • tests/Unit/GuildControls.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

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