You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: keep focus on guild buttons and toast when they're throttled - #1627
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.
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.
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.
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.
dev-null-sh/dev-null.sh#1620: Reuses the guild-preference update behavior and describes busy join buttons and 429 handling.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Join and Mute buttons on the Guilds page and on guild pages had two rough edges:
followsrate 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.disabled, so pressing Enter on Join dropped focus to the page. Now they'rearia-disabledand ignore clicks until the request ends, like the star and pastéis buttons. Focus stays on the button, now Leave.Changes
GuildPreferences:onHttpException: (response) => !toastWhenThrottled(response);updatewhile a request is in flight;aria-disabled={processing}instead ofdisabledon both buttons.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
5eb634e1(based onc2eccd80):composer test:lint,test:typesandtest:type-coveragepass.composer test:unitpasses 6,382 Pest tests at 100% coverage, 1,101 component tests and 321 JS tests./guilds, signed in with guild access:Visual evidence
Chrome at 2x,
/guildssigned in with guild access. Before isproduction(c2eccd80), after is5eb634e1.Join on Coffee while throttled:
While the join request is in flight (held open), 1440×900:
After pressing Enter on Join:
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):
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, head5eb634e1, media3746c7d3: 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
guild-preferences.tsxandGuildControls.test.tsx, on different lines. A three-way merge of the two applies cleanly.Summary by CodeRabbit