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

Restoring to incorrect scroll position #1719

Open
offbynull opened this issue Oct 1, 2019 · 0 comments

Comments

@offbynull
Copy link

commented Oct 1, 2019

Issue details

On both Firefox and Chromium, the scroll position isn't being restored properly on a browsersync-triggered reload. It's being offset. In the example GIF below, each browsersync-triggered reload restores the scroll position a little further down from the position it should be.

The larger the document is, the larger the offset is. You may need to scroll to a random position and trigger a few reloads to get it to happen.

L5HU9vSjFs

Steps to reproduce/test case

Checkout the feature/no_singlefile_output of https://github.com/offbynull/markdown-notes. Run with npm start -- example/

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [2.26.7]
  • Node [10.16.0]
  • Npm [6.10.1]

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

If CLI, please paste the entire command below

{cli command here}

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

{Browsersync init code here}

bs.init({
    server: outputPath,
    watch: true,
    watchOptions: {
        awaitWriteFinish: {
            stabilityThreshold: 100 // Wait until file size remains constant before reloading browser
        }
    },
    startPath: 'output.html',
    injectChanges: false,
    // ghostMode: false,
    reloadDelay: 0, // no point in artificially waiting before reloading?
    reloadOnRestart: true,
    // WORKAROUND FOR BUG -- https://github.com/BrowserSync/browser-sync/issues/1038
    // The embedded mathjax script has a <body> tag in it which triggers this bug. This same bug exists in competing tools (e.g.
    // live-server).
    snippetOptions: {
        rule: {
            match: /$/i,
            fn: (snippet, match) => snippet + match
        }
    }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.