-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat(scroll): smarter scroll behavior #744
Conversation
Please run these commands to trigger netlify deployment for this Pull Request: git commit --amend --no-edit
git push --force |
f3b506f
to
b38e740
Compare
@timaschew Done. |
Hey @solymosi, FYI: the DNS for the preview has changed: https://deploy-preview-744--docsifyjs.netlify.com
I totally agree with you. I've just tried some actions:
Expected: Scroll position at pagination When using Also I don't understand how auto2top: false can be useful. For me it's broken because if you open another page the scroll position is only correct if you didn't scroll on the previous page, which is mostly not the case. Or do I miss anything? (This is of course not directly related to your PR) |
Hmm... that looks like a bug, and it's reliably reproducable when:
I guess the reason is that the browser's scroll restoration behavior is invoked before the old page is properly replaced with the new one by Docsify and therefore the target scroll position is capped at the height of the old page. The fact that it's only triggered when using the The problem is that this may require implementing our own custom scroll restoration behavior and turning off the browser's default: https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration. But I'd need to do some digging first because there might be a simpler workaround as well. In any case, I'd recommend addressing this particular issue in a different PR.
I have no idea how it's useful either, but since it existed I assumed there was at least some reason for it, so I kept it in there. Totally fine with removing it, however. |
Merging this PR before the other one, actually let's say publishing a new version based on this PR would be a regression. Because currently it's working fine for URLs with an ID. Regarding /cc @jhildenbiddle |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
cc @solymosi whats the status on this ? |
Let me rebase this and resolve the conflicts. After that it can be merged, unless you'd like me to make additional changes. |
90c5850
to
d160e93
Compare
Rebased and fixed up the whitespace style to match that of the |
I will review it soon cc @timaschew your thoughts ? |
d160e93
to
2964305
Compare
Rebased again due to merge conflicts. Any updates on the review? |
can you please fix the CI issue. |
2964305
to
23060c9
Compare
Linting issues fixed ✔️ – couldn't do anything about the "security flow", that step seems to be broken. |
Currently Docsify has the following behavior when it comes to scrolling:
auto2top
is enabled then:auto2top
is disabled then:Ideally, the following should happen (in my opinion):
This PR implements this (in my opinion better) behavior for both the
hash
and thehistory
router modes. Scrolling to the top only happens ifauto2top
is enabled.It does not attempt to fix the inconsistent scrolling issue that's caused by images loaded asynchronously.
master
branch.lib
directory.