Skip to content

AutoScroll doesn't work well on sites with scroll-behavior: smooth #33

Description

@charukiewicz

Issue

I noticed that on some sites, using AutoScroll doesn't really work so well. It appears that the problem is the scroll-behavior CSS attribute. The default browser setting is:

html {
  scroll-behavior: auto; /* browser default */
}

Some sites override it to:

html {
  scroll-behavior: smooth;
}

Which leads to issues when using AutoScroll. Here's a side by side comparison on my personal site.

scroll-behavior: auto (click to show):
Regular scroll behavior. Responsive. Stops scrolling immediately upon clicking out of auto-scroll.

scroll-behavior: smooth (click to show):
Broken scroll behavior. Window scrolls very slowly, doesn't reverse direction correctly. Clicking out of auto-scroll causes browser to rapidly scroll in the direction that scroll was attempted.

Possible Fix

It seems like one potential fix would be to explicitly set scroll-behavior: auto on the html element of the document when auto-scroll is enabled. This would override the site's scroll-behavior setting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions