Skip to content

[Tabs] fix keepMounted for panel #1873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

ImSingee
Copy link

@ImSingee ImSingee commented May 6, 2025

Fixes #1872

Copy link

pkg-pr-new bot commented May 6, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@base-ui-components/react@1873

commit: c8927ca

Copy link

netlify bot commented May 6, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c8927ca
🔍 Latest deploy log https://app.netlify.com/sites/base-ui/deploys/6819b32a06ffdb0008b62c01
😎 Deploy Preview https://deploy-preview-1873--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mj12albert mj12albert added the type: bug Something doesn't work label May 6, 2025
@@ -47,10 +47,14 @@ export const TabsPanel = React.forwardRef(function TabPanel(
render: render ?? 'div',
className,
state,
extraProps: { ...other, children: hidden && !keepMounted ? undefined : children },
extraProps: { ...other, children },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extraProps: { ...other, children },
extraProps: other,

This should be enough, no need to destructure children anymore ~

@mj12albert
Copy link
Member

Was checking out the failing tests and found that this change would break the functionality when value isn't explicitly specified on both the Tab and the Panel (example). It's probably affecting the internal Composite in some way and I guess this could be why it was only unmounting the children

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs type: bug Something doesn't work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tabs] keepMounted={false} doesn't mount children but still mounts the root element
2 participants