Skip to content

refactor(mosaic): replace Floating UI Composite with useComposite - #10573

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-compsite
Nov 3, 2026
Merged

alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-compsite

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Description

Replaces Floating UI's Composite/CompositeItem with an in-house useComposite hook, so tabs, segmented control, accordion, action bar, tag input and the table's grid navigation share one roving-tabindex implementation. This removes the render-prop wrappers and is a step towards using Floating UI only for positioning.

  • Fixes: the tab stop now lands on a selected tab that isn't first, and arrow keys in a field inside an accordion panel stay with that field.
  • Item registration: items register through context and sort by document position, following FloatingList/useListItem. It uses a ref-backed Map rather than state, because no index is needed.
  • Unchanged: popup lists keep useListNavigation, OTP keeps its own handling, and the table keeps its DOM lookups for cells and widgets.
  • Behaviour difference: before hydration, server-rendered tabs now have no tabindex, where CompositeItem rendered them all as -1. The hook writes tabindex in a layout effect, which doesn't run on the server. After hydration there is one tab stop, as before.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 3, 2026 11:08pm UTC
swingset Ready Ready Preview Nov 3, 2026 11:08pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 012905e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/mosaic Patch
@clerk/swingset Patch

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

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The changes add a shared composite-navigation hook and item registry for tab-stop management, focus handling, and keyboard navigation. Action bar, accordion, segmented control, tabs, table navigation, and tag input adopt the hook. Tests cover navigation, tab stops, focus recovery, and key handling. Documentation, reuse guidance, and a patch changeset are also updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • clerk/javascript#10420: Adds the DirectionProvider and useDirection APIs used by composite-based navigation.
  • clerk/javascript#10414: Adds the headless Table primitive and grid-navigation hook that this change updates.
  • clerk/javascript#10421: Builds the styled Table on the headless Table primitive, which uses the updated grid-navigation hook.
Merge Risk: Minimal · previous review 89ae4

Tag navigation remains available when a consumer stops propagation. No merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the replacement of Floating UI composite components with the shared useComposite implementation and identifies related behavior changes.
Title check Passed The title clearly and concisely identifies the main change: replacing Floating UI Composite with useComposite.
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: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 14 functions across 19 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a519456 and 89ae462.

Files selected for processing: 4
  • packages/mosaic/src/primitives/tag-input/tag-input-context.ts
  • packages/mosaic/src/primitives/tag-input/tag-input-root.tsx
  • packages/mosaic/src/primitives/tag-input/tag-input-tag.tsx
  • packages/mosaic/src/primitives/tag-input/tag-input.test.tsx
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10573

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10573

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10573

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10573

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10573

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10573

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10573

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10573

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10573

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10573

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10573

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10573

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10573

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10573

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10573

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10573

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10573

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10573

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10573

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10573

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10573

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10573

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10573

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10573

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10573

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10573

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10573

commit: 012905e

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

@blacksmith-sh

blacksmith-sh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Matches Tab stop on selected non-first tab

Tested on c133a178, untouched since — Before, Tab lands on Account and its automatic activation switches the selection away from Security. After, Tab lands on the selected Security tab and the selection stays.

Merge-baseThis PR c133a178
Tab lands on AccountTab lands on Security

Also checked · 3 match

Matches Arrows stay in accordion panel field
Matches Roving nav in other composites
Matches SSR tabs have no tabindex

Proof on 012905ec (from c133a178) · Did Proof get it right? Yes · No

View full Proof report

@alexcarpenter
alexcarpenter merged commit 79138c0 into main Nov 3, 2026
57 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-compsite branch November 3, 2026 23:21

This branch was successfully deployed

2 active deployments
Preview – swingset — 012905ec Deployed Nov 3, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 012905ec Deployed Nov 3, 2026 by vercel[bot]
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.

2 participants