Add back-to-top button to blog posts - #13882
Open
manuelzzz wants to merge 2 commits into
Open
Conversation
manuelzzz
requested review from
a team,
abdallahshaban557 and
sfshaza2
as code owners
September 11, 2026 20:07
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a floating BackToTopButton component that allows users to smoothly scroll back to the top of blog posts. The button is integrated into the BlogLayout and styled to appear when the user scrolls down. Feedback on this PR focuses on accessibility improvements, specifically recommending that the button respect user motion preferences (prefers-reduced-motion) in both the Dart scroll behavior and the SCSS transitions, as well as explicitly setting the button type to prevent accidental form submissions.
Adds BackToTopButton, a floating button shown once the reader scrolls past the hero, that smooth-scrolls back to the top of the page on click. Reuses the site's existing in-content scroll-spy signal, so no new scroll-tracking JS was needed.
- Fall back to instant scrolling when the user has requested reduced motion, instead of always smooth-scrolling. - Disable the button's slide-up transform/transition under prefers-reduced-motion: reduce. - Set the button's type explicitly to 'button', so it can't accidentally submit a form if ever nested inside one.
manuelzzz
force-pushed
the
blog-back-to-top
branch
from
September 11, 2026 20:17
957dc5d to
0574eac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a back-to-top button to long-form blog posts to make navigation easier.
BackToTopButton(packages/site_shared/lib/components/common/client/back_to_top_button.dart), a floating button that appears after the reader scrolls past the hero and smoothly scrolls back to the top when clicked. It reuses the existingin-contentscroll-spy signal, so no additional scroll-tracking JavaScript is required.The button is implemented as a shared
site_sharedcomponent rather than directly insites/wwworsites/docs. For now, it is only wired into the blog layout, keeping it reusable for other long-form content in the future.This is a companion to the table of contents PR (#13881). The changes are intentionally split so both PRs can be reviewed and landed independently; there is no code dependency between them.
back-to-top-preview.mov