Skip to content

Commit fc27a88

Browse files
Force hidden TabPanels to render for SEO (#1450)
Ensure that hidden `<TabPanel>` content is crawlable by search engines by forcing all tab panels to render while remaining visually hidden and inert.
1 parent 750c129 commit fc27a88

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/gentle-sides-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@obosbbl/grunnmuren-react": patch
3+
---
4+
5+
SEO fix for `<Tabs>`: Force hidden TabPanels to render, while being `inert` and visually hidden. This ensures that `<TabPanel>` content is always crawlable by search engines.

packages/react/src/tabs/tabs.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ function TabPanel(props: TabPanelProps) {
281281
return (
282282
<RACTabPanel
283283
{...restProps}
284+
shouldForceMount
284285
className={cx(
285286
className,
286-
'flex-1 data-focus-visible:outline-focus-offset',
287+
'flex-1 data-inert:hidden data-focus-visible:outline-focus-offset',
287288
)}
288289
>
289290
{children}

0 commit comments

Comments
 (0)