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: prevent triggering "On this page" overlay on desktop #170

Merged
merged 3 commits into from Jul 6, 2023

Conversation

geoffrich
Copy link
Member

The existing implementation of the "On this page" nav still attached the click handler on the desktop view, even though the element was no longer a toggle. This meant you could still click it and the screen would dim, without any way to un-dim the screen.

This PR makes it so we only render a button (and attach the click handler) on mobile screen widths. It also improves semantics by reinstating the "On this page" h2, allowing assistive tech users to skip to it via heading shortcuts.

Swapping between the button and static text is done with CSS to avoid FOUC.

@geoffrich geoffrich requested a review from PuruVJ July 6, 2023 02:50
@changeset-bot
Copy link

changeset-bot bot commented Jul 6, 2023

🦋 Changeset detected

Latest commit: c4aee92

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/site-kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dummdidumm dummdidumm merged commit 5b9f8ec into master Jul 6, 2023
@dummdidumm dummdidumm deleted the grich/on-this-page-click branch July 6, 2023 09: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.

None yet

2 participants