Comments (9)
No need to remove smooth scrolling anymore. If you look at #37, I changed svelte-toc
to wait for any page scrolling to finish before scrolling the active ToC item into view. To fix your problem, try just updating svelte-toc
to latest.
from svelte-toc.
Actually, this won't work. No need to try the passive
modifier. I remember looking into this before. This appears to be a bug in Chromium that's been reported many times on SO and in the Chromium issue tracker as well:
- https://bugs.chromium.org/p/chromium/issues/detail?id=1121151
- https://bugs.chromium.org/p/chromium/issues/detail?id=1043933
- https://bugs.chromium.org/p/chromium/issues/detail?id=833617
which might explain why it's working in FF. Sadly no response from the Chromium devs yet.
from svelte-toc.
Thanks for the bug report. I think I remember seeing this as well at some point. Haven't had time to dig into it yet so can't offer a quick fix. A link to your site to see the problem in the wild would be great! 👍
from svelte-toc.
Thanks for the bug report. I think I remember seeing this as well at some point. Haven't had time to dig into it yet so can't offer a quick fix. A link to your site to see the problem in the wild would be great! 👍
I think it's browser specific, works almost fine with firefox (sometimes it goes to the wrong anchor, when I turn it off it works again in FF). In Chrome/Edge this always doesn't work for me.
Mondaystats.com/thesis
the references i.e. [18]
are the anchor links that I have.
Cheers,
Oli
from svelte-toc.
Yes, this is the behavior I remember seeing! I think making the scroll handler passive
might solve this problem. Is the code public? If not, could you edit the Toc.svelte
in your node_modules
in-place as follows?
<svelte:window
bind:innerWidth={window_width}
- on:scroll={set_active_heading}
+ on:scroll|passive={set_active_heading}
on:click={close}
/>
Be sure to restart the dev server. If you try that, let me know if it helps.
from svelte-toc.
Also, great work on that thesis! Very impressive. 👍
from svelte-toc.
2 workarounds:
- remove
html { scroll-behavior: smooth; }
- Pass
keepActiveTocItemInView={false}
to<Toc />
.
from svelte-toc.
@janosh thanks a lot for this (and the compliment :-)) I'll try with removing smooth scrolling, I have it through tailwind, and the second option too, I'll update if this works.
from svelte-toc.
No need to remove smooth scrolling anymore. If you look at #37, I changed
svelte-toc
to wait for any page scrolling to finish before scrolling the active ToC item into view. To fix your problem, try just updatingsvelte-toc
to latest.
That's awesome, thank you so much!
from svelte-toc.
Related Issues (20)
- Quick questions HOT 1
- Getting error about resolving `$app/stores` HOT 7
- Strange behaviour HOT 16
- Prevents scroll when using smart zoom on macOS HOT 1
- [Question] Split into sections HOT 4
- Component persisting on page change when not required HOT 2
- How do I customize the font-size of each item of the ToC? HOT 4
- New prop for toc nav overflow-y HOT 1
- Component insists on starting at full height above the text HOT 4
- [Question]TypeScript support HOT 4
- Is there an option to hide the scrollbar if the ToC doesn't reach certain size? Or just hide in general? HOT 4
- Disable blur initial transition animation HOT 1
- SvelteKit page navigation breaks when svelte-toc is shown HOT 1
- Add option to only show sublevel headings below currently active top-level heading
- Issues with highlighting the correct content HOT 1
- `keepActiveTocItemInView` should be false by default HOT 3
- Hide when intersecting with user-specified DOM nodes
- Add slots for custom ToC items HOT 1
- Add tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte-toc.