Make meetup in-page anchor links update the URL hash#1459
Merged
Conversation
On /meetup/alps/ and /meetup/rhine-ruhr/, the "Subscribe to Newsletter" and "Register for next meetup" buttons (plus their inline-text counterparts) scrolled to in-page sections but never updated the URL bar with #newsletter / #register, so the result could not be copied or shared as a deep link. The cause was a click handler in MeetupPageLayout.astro that called e.preventDefault() and performed a manual window.scrollTo, bypassing the browser's native anchor navigation that would have updated location.hash and history for free. The handler did nothing else — no focus management, no analytics, no sticky-header offset — so dropping it only forfeited the smooth scroll, which CSS scroll-behavior: smooth replaces. - Remove the data-scroll-to click handler from MeetupPageLayout.astro. - Remove the now-dead data-scroll-to attributes from the eight affected anchors; keep their href="#newsletter" / href="#register" so the browser resolves them natively to the existing <a name="…"> targets. - Add scroll-behavior: smooth to html in global.css so anchor jumps stay animated site-wide. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for nifty-bardeen-5c7e53 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
On
/meetup/alps/and/meetup/rhine-ruhr/, the Subscribe to Newsletter and Register for next meetup buttons (plus their inline-text counterparts further down the page) smoothly scrolled to the relevant in-page section but never updated the URL bar with#newsletter/#register. That made the result un-shareable: visitors couldn't copy the URL after clicking to send a deep link.Cause
A click handler in
MeetupPageLayout.astrocallede.preventDefault()and performed a manualwindow.scrollTo(...), bypassing the browser's native anchor navigation that would have updatedlocation.hashand pushed a history entry for free. The handler did nothing else — no focus management, no analytics, no sticky-header offset, noprefers-reduced-motionhandling — so dropping it only forfeited the smooth scroll, which CSSscroll-behavior: smoothreplaces.Changes
src/components/meetup/MeetupPageLayout.astro— Remove thedata-scroll-toclick handler and the eightdata-scroll-toattribute uses on the affected anchors. Keep each anchor'shref="#newsletter"/href="#register"so the browser resolves them natively to the existing<a name="…">targets (legacy named-anchor lookup, still supported by all modern browsers).src/styles/global.css— Addhtml { scroll-behavior: smooth; }inside the existing@layer base { … }block so anchor jumps stay animated site-wide.Verification
make build→ 477 pages built, no errors.make test-javascript→ 86 / 86 tests pass./meetup/alps/and/meetup/rhine-ruhr/:#newsletter/#register.…/meetup/alps/#newsletterdirectly in a new tab still jumps to the newsletter section on load.Out of scope (intentionally)
@media (prefers-reduced-motion: reduce)override — the previous JS didn't honor it either, so not a regression; happy to add as a one-line follow-up if desired.<a name="…">targets toid="…"— out of scope; the legacy form is still universally supported.🤖 Generated with Claude Code