diff --git a/src/Item.tsx b/src/Item.tsx index cfd18bd..c09bdc9 100644 --- a/src/Item.tsx +++ b/src/Item.tsx @@ -82,9 +82,13 @@ function InternalItem( }; } - const overflowProps: React.HTMLAttributes = {}; + const overflowProps: Omit, 'inert'> & { + inert?: boolean | ''; + } = {}; if (mergedHidden) { overflowProps['aria-hidden'] = true; + // React <= 18 only serializes unknown boolean attributes when passed as strings. + overflowProps.inert = Number.parseInt(React.version, 10) >= 19 ? true : ''; } let itemNode = ( diff --git a/tests/__snapshots__/ssr.spec.tsx.snap b/tests/__snapshots__/ssr.spec.tsx.snap index e5415e9..00b42a6 100644 --- a/tests/__snapshots__/ssr.spec.tsx.snap +++ b/tests/__snapshots__/ssr.spec.tsx.snap @@ -19,6 +19,7 @@ exports[`Overflow.SSR basic 1`] = `