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(plus): scroll to anchor hook #10364

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Conversation

fiji-flo
Copy link
Contributor

Summary

Add a scroll to anchor hook.

When navigating to a page via anchor link, scroll to the anchor via JS. We need this for non SSRed pages (mainly plus)

Correct scroll-margins is only supported Firefox (via :target) fully. For some reason Blink and WebKit seem to not set :target consitently. To work around this we set scroll-margin for section[id], too.


How did you test this change?

Locally

When navigating to a page via anchor link, scroll to the anchor via JS.
We need this for non SSRed pages (mainly plus).

Correct scroll-margins is only supported Firefox (via :target) fully.
For some reason Blink and WebKit seem to not set :target consitently.
To work around this we set scroll-margin for section[id], too.
@fiji-flo fiji-flo requested a review from a team as a code owner January 22, 2024 14:48
@github-actions github-actions bot added the plus work around features related to MDN Plus label Jan 22, 2024
Copy link
Contributor

@argl argl left a comment

Choose a reason for hiding this comment

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

No complaints, and it works for me on a quick check.

@fiji-flo fiji-flo merged commit 20db7d1 into main Jan 23, 2024
14 checks passed
@fiji-flo fiji-flo deleted the MP-703-scroll-to-anchor-hook branch January 23, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plus work around features related to MDN Plus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants