Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tabs] Tabs doesn't work with Tab as a custom component #27947

Open
2 tasks done
w3lld1 opened this issue Aug 24, 2021 · 3 comments
Open
2 tasks done

[Tabs] Tabs doesn't work with Tab as a custom component #27947

w3lld1 opened this issue Aug 24, 2021 · 3 comments
Labels
component: tabs This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@w3lld1
Copy link

w3lld1 commented Aug 24, 2021

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

Tabs doesn't switch between Tab if it's a custom component that returns Tab

Expected Behavior 馃

The same behavior as with Tab

Steps to Reproduce 馃暪

You can see this behavior here

Steps:

  1. Create component that returns Tab
  2. Use it in Tabs instead of Tab
@w3lld1 w3lld1 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 24, 2021
@eps1lon
Copy link
Member

eps1lon commented Aug 25, 2021

It doesn't look like this bug report has enough info for one of us to reproduce it.

Please provide a CodeSandbox (https://material-ui.com/r/issue-template-next), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.

Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

@eps1lon eps1lon added component: tabs This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 25, 2021
@w3lld1
Copy link
Author

w3lld1 commented Aug 25, 2021

It doesn't look like this bug report has enough info for one of us to reproduce it.

Please provide a CodeSandbox (https://material-ui.com/r/issue-template-next), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.

Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

I provided codesandbox example in my first message. Sorry if it wasn't noticeable.

Duplicate here:
https://codesandbox.io/s/material-demo-forked-vo6zv

@eps1lon
Copy link
Member

eps1lon commented Aug 25, 2021

I provided codesandbox example in my first message. Sorry if it wasn't noticeable.

My bad, sorry.

I checked the codesandbox and the issue is that props aren't spread to the actual Tab component like so:

-function CustomTab({ value }) {
-  return <Tab value={value} label={value} />;
+function CustomTab({ value, ...props }) {
+  return <Tab value={value} label={value} {...props} />;
}

Leaving this open since this is probably something we want to investigate for our experimental Tab API or at least provide a runtime warning.

@eps1lon eps1lon added new feature New feature or request and removed status: waiting for author Issue with insufficient information labels Aug 25, 2021
@hbjORbj hbjORbj changed the title Tabs doesn't work with Tab as a custom component [Tabs] Tabs doesn't work with Tab as a custom component Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants