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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs render incorrectly on server #907

Open
joshuajaco opened this issue Feb 15, 2022 · 5 comments
Open

Tabs render incorrectly on server #907

joshuajaco opened this issue Feb 15, 2022 · 5 comments
Labels
Type: Bug Something isn't working

Comments

@joshuajaco
Copy link

joshuajaco commented Feb 15, 2022

🐛 Bug report

Current Behavior

When rendered on the server all tabs are shown, regardless of the index prop.

Expected behavior

Only the tab for the active index is shown.

Reproducible example

https://codesandbox.io/s/reverent-sun-w205d

Additional context

We are using the Tabs inside a remix app. Since the server shows all tabs, but on client side they are hidden, the content jumps.

Your environment

Software Name(s). Version
Reach Package Tabs 0.16.4
React 17.0.2
@joshuajaco
Copy link
Author

Possibly related to #624

@chaance
Copy link
Member

chaance commented Jul 13, 2022

This is a known limitation of how we automatically track indices, which require a second render pass. To prevent the jump you'll need to pass an index prop to each Tab and its corresponding TabPanel component.

See #624 (comment)

@chaance chaance closed this as completed Jul 13, 2022
@joshuajaco
Copy link
Author

This is a known limitation of how we automatically track indices, which require a second render pass. To prevent the jump you'll need to pass an index prop to each Tab and its corresponding TabPanel component.

See #624 (comment)

I still get the same behaviour (all tabs are rendered on the server) after adding the index prop to all Tabs and TabPanels: https://codesandbox.io/s/gracious-pare-urlj5j

@HuyAms
Copy link

HuyAms commented Sep 26, 2022

Is there any fix/ around to this issue yet?

@martinmckenna
Copy link

bumping. looking for a working solution here as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants