Skip to content

click left sidebar, then refresh the page, lost the sync scroll. #1136

Closed

Description

@vagra

Bug Report

Steps to reproduce

  1. open a page like https://docsify.js.org/#/configuration

  2. click a sub-sidebar link (the toc of current document), or click a heading in the main content

  3. using F5, refresh the current page

What is current behaviour

the page lost sync scroll.
when you scroll the main page, the sidebar could not sync scroll.

What is the expected behaviour

the sidebar sync scroll always.

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS:

  • Node.js version:

  • npm/yarn version:

  • Browser version:

  • Docsify version:

  • Docsify plugins:

Please create a reproducible sandbox

Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)

Activity

  1. vagra commented on Apr 24, 2020

    @vagra
    ContributorAuthor

    if I don't click the left sidebar item, when refresh the page using F5, I always sync scroll.

  2. vagra commented on Apr 24, 2020

    @vagra
    ContributorAuthor

    see this code in scroll.js

    export function scrollActiveSidebar(router) {
    
      const path = router.getCurrentPath();
      console.log(path);  // log info for test
      dom.off('scroll', () => highlight(path));
      dom.on('scroll', () => highlight(path));
    
    }
    

    if I don't click the links at main content or side bar, the path is :

    /docs/pagename
    

    if I clicked the links at main content or side bar, the path is:

    /docs/pagename?id=anchorid
    

    but in the function highlight(path) , does not handle the id in path.

  3. added a commit that references this issue on Apr 24, 2020
  4. added a commit that references this issue on May 3, 2020
    b2dd708
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

    bugconfirmed as a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions