Skip to content

fixed scroll back to top #132

Open
agigibairene wants to merge 1 commit intojson-schema-org:mainfrom
agigibairene:scroll-to-top
Open

fixed scroll back to top #132
agigibairene wants to merge 1 commit intojson-schema-org:mainfrom
agigibairene:scroll-to-top

Conversation

@agigibairene
Copy link
Copy Markdown

What kind of change does this PR introduce?
Bugfix: adds smooth scroll behavior to the back-to-top button on the guide page.

Issue Number:

Screenshots/videos:
Screencast from 2026-03-23 03-43-18.webm

Summary
The back-to-top button on the guide page was sending users instantly to the top without any animation, which felt abrupt, especially on longer sections. This PR fixes that by injecting a smooth scroll script into build/index.html via build.sh after the build, following the same pattern used in #130 for the target="_blank" patch.

The fix intercepts the button's click event in the capture phase and calls scrollTo({ behavior: 'smooth' }) on the correct scroll container. On smaller screens, the page scrolls via window; on larger screens, the content scrolls inside an unnamed div container, and the script detects whichever container is active and targets it.

Fixes: back-to-top button abrupt jump on both small and large screen layouts.

Does this PR introduce a breaking change?
No, only makes changes on the scroll to top button button[aria-label="Scroll to top"] element.

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.

fix: back-to-top button jumps instantly — add smooth scroll transition

1 participant