feat(theme): Use React context for <Tabs>, allow custom <TabItem> components#11733
feat(theme): Use React context for <Tabs>, allow custom <TabItem> components#11733
<Tabs>, allow custom <TabItem> components#11733Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: +268 B (0%) Total Size: 11.8 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Size Change: +258 B (0%) Total Size: 12.3 MB ℹ️ View Unchanged
|
|
@slorber Detailselement might already handles show/hideautomatically |
|
@akshatsinha0 I'm not sure I understand what you mean exactly, but I'd rather not refactor this Details component at this point because we want to re-implement this later and get closer to the native details behavior. Our current implementation has issues, and new browser capabilities are deployed to support collapsing animations without JS. See also #10055 |
Got it, makes sense ; I was thinking about it from the wrong angle. Checked it out, the CSS only approach using ::details-content transitions is different direction. |
|
It looks like this change broke |
Docusaurus 3.10.0 refactored the internal Tabs system to use React context (facebook/docusaurus#11733), breaking all custom tab components. - Replace useTabs(props) with useTabsContextValue(props) + TabsProvider - Remove cloneElement hidden prop injection (TabItem self-manages via context) - Consolidate imports to @docusaurus/theme-common/internal (deep lib/ paths are now restricted by the package exports field) - Update ambient type declarations in theme-classic.d.ts - Bump Docusaurus peerDeps/devDeps to ^3.10.0 Closes #1395 Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix: update Tabs API for Docusaurus 3.10.0 compatibility Docusaurus 3.10.0 refactored the internal Tabs system to use React context (facebook/docusaurus#11733), breaking all custom tab components. - Replace useTabs(props) with useTabsContextValue(props) + TabsProvider - Remove cloneElement hidden prop injection (TabItem self-manages via context) - Consolidate imports to @docusaurus/theme-common/internal (deep lib/ paths are now restricted by the package exports field) - Update ambient type declarations in theme-classic.d.ts - Bump Docusaurus peerDeps/devDeps to ^3.10.0 Closes #1395 Co-Authored-By: Claude Opus 4.6 <[email protected]> * refactor: remove unnecessary cloneElement in non-lazy TabContent With TabItem now self-managing visibility via context, the cloneElement call that only injected key was dead weight. Render children directly instead. Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
…cusaurus 3.10.0 upgrade @camunda8/docusaurus-theme-openapi-docs 4.6.4 pulls in @docusaurus/* 3.10.0 as transitive dependencies, which introduces a breaking React Context change in Tabs (facebook/docusaurus#11733) causing SSG failures across all versioned docs pages (ReactContextError at useDocsPreferredVersionContext). Additionally, Docusaurus 3.10.0 renamed 'experimental_faster' to 'faster' in the site config, which is incompatible with 3.9.x. Pin the OpenAPI packages to exact 4.6.3 and keep Docusaurus at 3.9.2 until the OpenAPI theme is updated for Docusaurus 3.10.0 compatibility.
Motivation
The theme
<Tabs>component implementation was not very flexible to support many composition patterns, assuming that<TabItem>must be a direct child of<Tabs>to work, relying onelement.props.valueandcloneElement()clunky APIs.This PR introduces a context for each
<Tabs>so that<TabItem>can be wrapped in more flexible ways.This required some refactoring that also cleans up a bit of this historically complex component. The component can be further simplified / splitted in follow up PRs.
Fix #11672
Test Plan
CI + unit tests + dogfood + Argos
Test links
https://deploy-preview-11733--docusaurus-2.netlify.app/docs/markdown-features/tabs
https://deploy-preview-11733--docusaurus-2.netlify.app/tests/pages/tabs-tests