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(docs): fix scroll selector to scroll to top on page change #4364

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

evwilkin
Copy link
Member

Closes #4363

This PR fixes pages not scrolling to top when navigating to a new page.

It updates the Link component and TableOfContents component to revert the scrollSelector change from #4197 which is no longer needed after Core update patternfly/patternfly#7025 was merged.

@patternfly-build
Copy link
Contributor

patternfly-build commented Oct 31, 2024

@evwilkin evwilkin requested review from srambach and kmcfaul November 1, 2024 15:32
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM!

It looks like there can be a slight delay for the page loading and the page title swap can happen after the anchor change, which feels a little weird. Is that a separate issue, or something we should look at in this PR?

Nov-11-2024.15-40-13.mp4

@evwilkin
Copy link
Member Author

@mcoker good callout, I've moved the page scrolling inside the promise to trigger after page navigation 👍

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

🚀

@@ -117,7 +91,7 @@ export const TableOfContents = ({ items }) => {
<JumpLinks
label="Table of contents"
isVertical
scrollableSelector=".pf-v6-c-page__main-container"
scrollableSelector="#ws-page-main"
className="ws-toc"
style={{ top: stickyNavHeight }}
offset={width > 1450 ? 108 + stickyNavHeight : 148 + stickyNavHeight}
Copy link
Member

Choose a reason for hiding this comment

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

Probably a new issue - but with the jumplinks collapsed, I notice that the scroll position puts the title underneath the jumplink toggle. The page switch looks 👌🏻 though!

Copy link
Member Author

Choose a reason for hiding this comment

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

@srambach I'm only able to recreate if I navigate to a jumplink on desktop layout and then shrink the screen down so the jumplinks move from the side to the top as seen in the video, did you see it anywhere else? Navigating from this point forward seems to work as expected at the new screen size.

Screen.Recording.2024-11-15.at.11.55.57.AM.mov

@evwilkin evwilkin merged commit c0a0c26 into patternfly:main Nov 15, 2024
4 checks passed
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.

Bug - Scroll position doesn't change between pages
4 participants