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

Improve table of contents intersection observer #64

Merged
merged 3 commits into from
May 17, 2023
Merged

Conversation

delucis
Copy link
Member

@delucis delucis commented May 17, 2023

I’ve played with a couple different strategies.

This PR adds code to actually recreate the intersection observer entirely when the window resizes. This lets us use really specific margins based on the window’s clientHeight instead of trying to get percentage margins to work OK across all viewport heights. It’s slightly more JS, but we’re debouncing the resize event & waiting for idle in browsers that support that, so should be pretty performant.

@changeset-bot
Copy link

changeset-bot bot commented May 17, 2023

🦋 Changeset detected

Latest commit: 6e22488

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

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight 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

@netlify
Copy link

netlify bot commented May 17, 2023

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 6e22488
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/6464bc85e8058000089b7a6e
😎 Deploy Preview https://deploy-preview-64--astro-starlight.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 site settings.

@github-actions
Copy link
Contributor

github-actions bot commented May 17, 2023

size-limit report 📦

Path Size
/index.html 10.58 KB (-0.01% 🔽)
/_astro/*.js 15.96 KB (+1.12% 🔺)
/_astro/*.css 8.8 KB (0%)

@delucis delucis merged commit 4460e55 into main May 17, 2023
@delucis delucis deleted the chris/betterToC branch May 17, 2023 11:43
@astrobot-houston astrobot-houston mentioned this pull request May 17, 2023
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