fix(ui): inert attribute for React 18/19 compatibility#8820
fix(ui): inert attribute for React 18/19 compatibility#8820alexcarpenter wants to merge 6 commits into
inert attribute for React 18/19 compatibility#8820Conversation
🦋 Changeset detectedLatest commit: a0d17a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis pull request adds a shared ChangesReact 19 inert attribute compatibility
🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
inert attribute for React 18/19 compatibility
API Changes Report
Summary
@clerk/sharedCurrent version: 4.17.1 Subpath
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/expo
@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: |
Empty string '' is falsy in React 19's boolean attribute handler and does not set the inert attribute, leaving hidden content interactive. 'true' is truthy in both React 18 and 19. Also adds global.d.ts type augmentation to packages/headless and packages/ui, removes per-site @ts-ignore suppressions, and adds ESLint no-unknown-property ignore for inert.
inert is already a recognized DOM property in eslint-plugin-react, and no usage is on a literal DOM element, so the ignore entry had no effect.
4827952 to
b9f3cd6
Compare
Replace the duplicated per-package inert.ts utilities in @clerk/ui and @clerk/headless with a single canonical helper at @clerk/shared/inert. Adds @clerk/shared as @clerk/headless's first internal dependency and externalizes it in the headless vite build.
b9f3cd6 to
a0d17a5
Compare
Summary
inerta real boolean attr → falsy''no longer sets it → hidden panel/collapsible/keyless content stayed interactive when rendered in host appinertProps(active)helper picks the value each React major reflects (18 →''string, 19 →trueboolean; both serialize toinert="")parseInt(version)) read once at module scope from the consumer's peerreact; covers0.0.0-experimental-*(major 0 → modern)Record<string, unknown>spread → no@ts-ignore/as any, noreacttype augmentation@clerk/shared/inert, consumed by@clerk/ui+@clerk/headless(no duplication)Why this subpath, not
/domor/react@clerk/shared/domis framework-agnostic +reactis an optional peer there → importingreactinto that barrel forces it on non-reactdomconsumers@clerk/shared/reactis a heavy barrel (hooks, contexts, query client) +sharedhas nosideEffects: false→ wouldn't tree-shake, lean headless pulls the whole graph@clerk/shared/webauthn//colorconventionNotes
@clerk/headlessgains its first internal dep (@clerk/shared); externalized in its vite build (matches@floating-ui/react)api-changesworkflow will flag it (additive)Test plan
pnpm --filter @clerk/ui test— Collapsible inert tests (presence-only assertion)pnpm --filter @clerk/headless test— tabs panel inert testspnpm --filter @clerk/shared testSummary by CodeRabbit
Bug Fixes
inertattribute behaves correctly across React 18 and React 19 so non-interactive content remains properly disabled.Tests
inertbehavior for tabs and collapsible components, including post-interaction updates.Chores
inerthandling, updated package build config and dependencies, and published patch release notes.