Skip to content

Does it possible to scroll when <a/> is clicked but not hashchange? #1780

Description

@Kido-200

Feature request

What problem does this feature solve?

Click a a link after first time, it will not scroll.

What does the proposed API look like?

https://ant.design/components/grid/#components-grid-demo-flex-align
In antd doc, we can click the right siderbar to trigger scroll everytime.
image

How should this be implemented in your opinion?

Maybe addEventListener to click, and scroll when a link is clicked?
image

Are you willing to work on this yourself?

I can try, but I just begin with using doscify,maybe have a lot of conflicts with other ability.

Activity

  1. sy-records commented on Mar 29, 2022

    @sy-records
    Member

    docsify does not provide a right sidebar, you can use a plugin for that.
    The right sidebar of antd doc is actually also in the form of anchor points.

  2. Kido-200 commented on Mar 29, 2022

    @Kido-200
    Author

    docsify does not provide a right sidebar, you can use a plugin for that. The right sidebar of antd doc is actually also in the form of anchor points.

    不好意思,我可能没表述好。
    在docsify的siderbar,点击同一个sider item,第二次开始,不会触发滚动,而antd的每次点击都可以触发滚动。可以做成每次点击能触发吗?

  3. Koooooo-7 commented on Mar 29, 2022

    @Koooooo-7
    Member

    Could u provide some details based on our site https://docsify.js.org/ ?
    I have no idea what you meant scroll when <a/> is clicked but not hashchange.

  4. Kido-200 commented on Mar 29, 2022

    @Kido-200
    Author

    Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

    https://docsify.js.org/#/pwa?id=create-serviceworker
    click "Create serviceWorker", then scroll the page, then click "Create serviceWorker" again, it will not scroll.Because the hash is not changed.
    image

  5. Koooooo-7 commented on Mar 29, 2022

    @Koooooo-7
    Member

    Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

    https://docsify.js.org/#/pwa?id=create-serviceworker click "Create serviceWorker", then scroll the page, then click "Create serviceWorker" again, it will not scroll.Because the hash is not changed. image

    Gotcha, I'm wondering what the use case that you wanna scroll back to the section header when you click it again.
    Normally, there is no need to back to current content's header indeed.

  6. Kido-200 commented on Mar 29, 2022

    @Kido-200
    Author

    Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

    https://docsify.js.org/#/pwa?id=create-serviceworker click "Create serviceWorker", then scroll the page, then click "Create serviceWorker" again, it will not scroll.Because the hash is not changed. image

    Gotcha, I'm wondering what the use case that you wanna scroll back to the section header when you click it again. Normally, there is no need to back to current content's header indeed.

    Sometimes the sction is long, and click and scroll is very natural in my mind, just like "back to top" button, so I click it,but nothing happend which makes me confused.
    Meanwhile, when I use antd or other website, they can scroll natural , which make me feel inconsistent.

    So it's just for enhancing the feel of interaction in some special situation, maybe I am a bit nitpicky. Thanks for your reply.

  7. Koooooo-7 commented on Mar 29, 2022

    @Koooooo-7
    Member

    Sometimes the sction is long, and click and scroll is very natural in my mind, just like "back to top" button, so I click it,but nothing happend which makes me confused. Meanwhile, when I use antd or other website, they can scroll natural , which make me feel inconsistent.

    AFAIK, the sort of antd sites have the anchor siderbar, it is different.

    So it's just for enhancing the feel of interaction in some special situation, maybe I am a bit nitpicky. Thanks for your reply.

    no prob.
    Currently, If you wanna click back the section header, you could clink to other sidebar link and back instead.

  8. andrewkmin commented on Mar 31, 2022

    @andrewkmin

    Currently, If you wanna click back the section header, you could clink to other sidebar link and back instead.

    another approach would be to refresh the page, which should take you to where you were last anchored

  9. sy-records commented on Jul 25, 2025

    @sy-records
    Member

    Fixed via #2575

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions