Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chubby-bats-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@node-core/ui-components': patch
---

Always mount CodeTabs, even when inactive
5 changes: 5 additions & 0 deletions packages/ui-components/src/Common/CodeTabs/index.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
@reference "../../styles/index.css";

.root {
/* `forceMount` keeps every panel in the DOM, so hide the inactive ones here */
> [role='tabpanel'][data-state='inactive'] {
@apply hidden;
}

> [role='tabpanel'] > :first-child {
@apply rounded-t-none;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/ui-components/src/MDX/CodeTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ const MDXCodeTabs: FC<MDXCodeTabsProps> = ({
{...props}
>
{languages.map((_, index) => (
<TabsPrimitive.Content key={tabs[index].key} value={tabs[index].key}>
<TabsPrimitive.Content
forceMount
key={tabs[index].key}
value={tabs[index].key}
>
{codes[index]}
</TabsPrimitive.Content>
))}
Expand Down
Loading