question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tabs] not working correctly with `react-router-dom`

See original GitHub issue

Bug report

Current Behavior

When content is long and you scroll down a bit, navigating to other route/tab with TabTrigger with react router-dom Link doesn’t change its route.

Here’s a video of showing it: https://streamable.com/vrw0hg

Expected behavior

When content is long and you scroll down a bit, navigating to other route/tab with TabTrigger with react router-dom Link should change its route.

Reproducible example

Repro

Your environment

Software Name(s) Version
Radix Package(s) Tabs 0.1.4
React n/a 17.0.2
Browser Chrome 97.0.4692.99
Assistive tech
Node n/a
npm/yarn
Operating System

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jjenzzcommented, Feb 9, 2022

@johnopleda ah, that is the same issue. The tab content is updating on pointer down so your mouse is not over the tab anymore when you release your pointer and click never fires on the Link to change the url.

It seems the best solution would be to control it. Here’s a more declarative way of controlling that just dawned on me and wouldn’t mean a reliance on implementation detail remaining stable https://codesandbox.io/s/zen-frog-88tv3?file=/src/App.js

1reaction
jjenzzcommented, Feb 15, 2022

I really don’t know the answer tbh. I thought the same as you initially but then i found the youtube example which uses role=tab and it muddied the waters.

what if you have tabs in your app that aren’t app navigation (so no aria-current) and then the boss asks for them to have permalink functionality for sharing? i’ve had this exact use-case before on a previous app where app state was in URL.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MUI Nav Tabs does not work with react-router - Stack Overflow
1 Answer 1 · It's working fine. Thanks. You use the tab component in the route. · @MijanurRahman do the same thing just...
Read more >
Routing with Tab does not work properly - Ionic React
When I tried to have a default route of / and a subroute with tabs When the page goes back to root route,...
Read more >
Handling Tabs Using Page URLs and React Router Doms
Learn how to maintain your active tab by using URL parameters and leveraging React Router Dom instead of using React state.
Read more >
Tab components - React-Bootstrap
Tabs is a higher-level component for quickly creating a Nav matched with a set ... Your monument shall be my gentle verse, Which...
Read more >
Strict Mode - React
Detecting unexpected side effects. Conceptually, React does work in two phases: The render phase determines what changes need to be made to e.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found