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

fix: left nav duplicate active selection and jumping scroll #819

Merged
merged 27 commits into from
May 19, 2020

Conversation

jnm2377
Copy link
Contributor

@jnm2377 jnm2377 commented Apr 21, 2020

Closes #386
Closes #345

@jnm2377 jnm2377 requested review from a team, vpicone and sstrubberg and removed request for a team April 21, 2020 20:24
@vercel
Copy link

vercel bot commented Apr 21, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/carbon-design-system/gatsby-theme-carbon/nkdzoo89a
✅ Preview: https://gatsby-theme-carbon-git-fork-jnm2377-left-nav-jump.carbon-design-system.now.sh

@vpicone vpicone self-requested a review April 29, 2020 21:07
@vpicone
Copy link
Contributor

vpicone commented Apr 29, 2020

Lookin good! do you mind doing a quick video of how we can test this/see it in action?

@vercel vercel bot temporarily deployed to Preview May 5, 2020 18:01 Inactive
@jnm2377
Copy link
Contributor Author

jnm2377 commented May 5, 2020

@sstrubberg I just pushed what I'm testing with. The duplicate accordion nav items. Is that still showing the issue for you?

@sstrubberg
Copy link
Member

Huzzah! not sure what was different, but both the deploy preview and my local environment are singing.

However, that linting error is still there.
image

@sstrubberg
Copy link
Member

Should we just give it an // eslint-disable-line react-hooks/exhaustive-deps?

@vpicone
Copy link
Contributor

vpicone commented May 6, 2020

@sstrubberg @jnm2377 those eslint react hooks rules from the react team are super well thought out, I'm down for disabling some rules for old code but we it looks like they've caught something that's a little off here.

@vpicone
Copy link
Contributor

vpicone commented May 6, 2020

Since the left nav is the only thing that cares about the scroll position, I'm not sure it makes sense to lift it all the way up to the app level context. Gatsby let's you pass state to a link, maybe we pass that into our side nav items and use it via location.state to set the position after the page loads. https://www.gatsbyjs.org/docs/gatsby-link/#pass-state-as-props-to-the-linked-page

@vercel vercel bot temporarily deployed to Preview May 7, 2020 21:31 Inactive
@vpicone
Copy link
Contributor

vpicone commented May 8, 2020

I think it's looking great. Only issue now is when there's two menu's open and one closes after navigation, the new scroll position is off. Verified with @aagonzales that the open state of the menus should persist through navigation. That way the mouse is still over the target they interacted with.

@vercel vercel bot temporarily deployed to Preview May 13, 2020 21:38 Inactive
@jnm2377
Copy link
Contributor Author

jnm2377 commented May 13, 2020

@vpicone @sstrubberg this is ready for re-review.

@sstrubberg sstrubberg merged commit 5aa20b9 into carbon-design-system:master May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LeftNav/Tabs active selection bugs QA: nav jumps back up to top when you click on a page below "fold"
3 participants