Skip to content

Make meetup in-page anchor links update the URL hash#1459

Merged
andygrunwald merged 1 commit into
mainfrom
andygrunwald/meetup-anchor-url-update
May 22, 2026
Merged

Make meetup in-page anchor links update the URL hash#1459
andygrunwald merged 1 commit into
mainfrom
andygrunwald/meetup-anchor-url-update

Conversation

@andygrunwald
Copy link
Copy Markdown
Contributor

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.astro called e.preventDefault() and performed a manual window.scrollTo(...), bypassing the browser's native anchor navigation that would have updated location.hash and pushed a history entry for free. The handler did nothing else — no focus management, no analytics, no sticky-header offset, no prefers-reduced-motion handling — so dropping it only forfeited the smooth scroll, which CSS scroll-behavior: smooth replaces.

Changes

  • src/components/meetup/MeetupPageLayout.astro — Remove the data-scroll-to click handler and the eight data-scroll-to attribute uses on the affected anchors. Keep each anchor's href="#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 — Add html { 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.
  • Manual on /meetup/alps/ and /meetup/rhine-ruhr/:
    • Clicking each top button → smooth scroll and the URL bar updates with #newsletter / #register.
    • Inline-text duplicates of those links behave the same.
    • Back / Forward navigates between scroll positions as expected.
    • Opening …/meetup/alps/#newsletter directly 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.
  • Migrating <a name="…"> targets to id="…" — out of scope; the legacy form is still universally supported.

🤖 Generated with Claude Code

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>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2026

Deploy Preview for nifty-bardeen-5c7e53 ready!

Name Link
🔨 Latest commit 34e52ca
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bardeen-5c7e53/deploys/6a0ff731d7d2b20008281f22
😎 Deploy Preview https://deploy-preview-1459--nifty-bardeen-5c7e53.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@andygrunwald andygrunwald merged commit b81df98 into main May 22, 2026
6 checks passed
@andygrunwald andygrunwald deleted the andygrunwald/meetup-anchor-url-update branch May 22, 2026 16:29
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.

1 participant