fix(ui): inert attribute for React 18/19 compatibility#8820
fix(ui): inert attribute for React 18/19 compatibility#8820alexcarpenter wants to merge 4 commits into
inert attribute for React 18/19 compatibility#8820Conversation
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.
🦋 Changeset detectedLatest commit: 91077cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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.
1 Skipped Deployment
|
📝 WalkthroughWalkthroughThis PR fixes React 19 compatibility for the HTML ChangesReact 19 inert attribute compatibility
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 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. ✨ Finishing Touches📝 Generate docstrings
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
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
@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: |
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.
Summary
''(empty string) is falsy in React 19's boolean attribute handler and does not set theinertattribute, leaving hidden panel/collapsible content focusable and interactiveinertusages to'true'(truthy in both React 18 and 19) so the attribute is always present when neededdeclare module 'react'type augmentation topackages/ui/src/global.d.tsand a newpackages/headless/src/global.d.ts, replacing three ad-hoc@ts-ignore/as anysuppressionsHow
'true'works in both versionsinerthandlingsetAttribute('inert', 'true')node.inert = 'true'→Boolean('true') === trueinert="true"inert=""Tests assert
toHaveAttribute('inert')(presence only) since the rendered value intentionally differs between versions.Test plan
pnpm --filter @clerk/ui test— all 27 Collapsible tests pass,inerttests updated to presence-only assertionpnpm --filter @clerk/headless test— new "non-selected panels have inert attribute" and "inert updates when selection changes" tests passSummary by CodeRabbit