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

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

Open
Kido-200 opened this issue Mar 29, 2022 · 8 comments
Open

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

Kido-200 opened this issue Mar 29, 2022 · 8 comments

Comments

@Kido-200
Copy link

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.

@sy-records
Copy link
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.

@Kido-200
Copy link
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的每次点击都可以触发滚动。可以做成每次点击能触发吗?

@Koooooo-7
Copy link
Member

Koooooo-7 commented Mar 29, 2022

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.

@Kido-200
Copy link
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

@Koooooo-7
Copy link
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.

@Kido-200
Copy link
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.

@Koooooo-7
Copy link
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.

@andrewkmin
Copy link

andrewkmin commented Mar 31, 2022

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

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

No branches or pull requests

4 participants