Skip to content

Fix anchor links not scrolling in mobile hamburger menu#3121

Open
emmyKcodes wants to merge 1 commit into
TypeStrong:masterfrom
emmyKcodes:fix/mobile-menu-anchor-scroll
Open

Fix anchor links not scrolling in mobile hamburger menu#3121
emmyKcodes wants to merge 1 commit into
TypeStrong:masterfrom
emmyKcodes:fix/mobile-menu-anchor-scroll

Conversation

@emmyKcodes

Copy link
Copy Markdown

What was broken

Tapping an anchor link in the mobile sidebar menu updated the URL hash but didn't scroll to the target.

Root cause

.has-menu body { overflow: hidden } is still active when the browser tries to do its native scroll-to-hash, since Toggle.ts doesn't close the menu (and lift the scroll lock) until a 250ms setTimeout later. By then the native scroll opportunity has passed.

Fix

Toggle.ts now manually calls scrollIntoView() on the target after closing the menu, instead of relying on the browser's one-shot native scroll.

Testing

Verified on [device/browser] that tapping sidebar anchors now scrolls correctly.

Fixes #3049

@emmyKcodes emmyKcodes force-pushed the fix/mobile-menu-anchor-scroll branch from 3b87f85 to 783045c Compare July 8, 2026 08:19
@emmyKcodes emmyKcodes force-pushed the fix/mobile-menu-anchor-scroll branch from 783045c to 31b42bb Compare July 8, 2026 08:47
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.

Anchor links inside mobile hamburger menu do not scroll to target (URL updates, scroll does not)

1 participant