Giter Site home page Giter Site logo

Comments (9)

janosh avatar janosh commented on May 24, 2024 2

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.

janosh avatar janosh commented on May 24, 2024 1

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:

which might explain why it's working in FF. Sadly no response from the Chromium devs yet.

from svelte-toc.

janosh avatar janosh commented on May 24, 2024

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.

aegonwolf avatar aegonwolf commented on May 24, 2024

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.

janosh avatar janosh commented on May 24, 2024

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.

janosh avatar janosh commented on May 24, 2024

Also, great work on that thesis! Very impressive. 👍

from svelte-toc.

janosh avatar janosh commented on May 24, 2024

2 workarounds:

  1. remove
    html {
      scroll-behavior: smooth;
    }
  2. Pass keepActiveTocItemInView={false} to <Toc />.

from svelte-toc.

aegonwolf avatar aegonwolf commented on May 24, 2024

@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.

aegonwolf avatar aegonwolf commented on May 24, 2024

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.

That's awesome, thank you so much!

from svelte-toc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.