refactor(ui): render user button rows with the headless Button - #9403
Conversation
Replaces the hand-rolled disabled-but-focusable row button with the headless Button's focusableWhenDisabled.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 5616d58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
📝 WalkthroughWalkthroughThe user-button row renderer now uses Clerk Headless Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/mosaic-user-button-headless-row.md:
- Around line 1-2: Add a valid Changeset entry in the file by declaring the
package from packages/ui/package.json with a patch bump and including a concise
release note describing the UserButton change; retain the required Changeset
frontmatter delimiters.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: d9c5a19d-cf42-46e4-b20c-f2854e1859dc
📒 Files selected for processing (3)
.changeset/mosaic-user-button-headless-row.mdpackages/ui/src/mosaic/user-button/__tests__/user-button.view.test.tsxpackages/ui/src/mosaic/user-button/user-button.view.tsx
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)clerk/cli(auto-detected)clerk/clerk-ios(auto-detected)clerk/clerk-android(auto-detected)
| --- | ||
| --- |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Add the packages/ui patch entry.
This file contains only Changeset delimiters. It does not declare a package, a patch bump, or a release note. Add the patch entry for the package defined by packages/ui/package.json and describe this UserButton change.
As per coding guidelines, “Use Changesets for managing releases.” The PR objective also requires a patch changeset for this packages/ui change.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.changeset/mosaic-user-button-headless-row.md around lines 1 - 2, Add a
valid Changeset entry in the file by declaring the package from
packages/ui/package.json with a patch bump and including a concise release note
describing the UserButton change; retain the required Changeset frontmatter
delimiters.
Source: Coding guidelines
Description
The rows in the Mosaic
UserButtonpopup stand down while another action runs, and they do it througharia-disabledrather than the native attribute so the row that owns the action keeps its place in the tab order while its spinner is announced. That was a localasButtonrender helper inuser-button.view.tsx, written before the headlessButtonexisted.The headless
Buttonnow owns that behavior, so the rows use it:<Button disabled focusableWhenDisabled />asItem.Root'srender. Alongside dropping the press, the rows now get the pointer-press suppression that actually keeps focus put,Enter/Spaceneutered whileTabstill moves off, and adata-disabledattribute to style against.One test needed a line. The headless
Buttonpreventspointerdown, and user-event skipsmousedownwhen it is prevented — along with the focus step that lives on it, which had been pulling focus back from the popup's own initial focus. The test now waits for that initial focus to land before the row takes it.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change