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

doc: fix issues related to page scrolling #6641

Closed
wants to merge 1 commit into from

Conversation

silverwind
Copy link
Contributor

@silverwind silverwind commented May 8, 2016

Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Description of change

Moved the sidebar to a fixed position and moved the positioning of the main content to the page's body, which results in back/forward navigation through hash links and search highlight working again.

Added a script to prevent the main column from unintentional scrolling when the sidebar is scrolled outside its boundaries.

Fixes: #6637
Based on: #5716

@silverwind silverwind added the doc Issues and PRs related to the documentations. label May 8, 2016
@silverwind
Copy link
Contributor Author

@nodejs/website @nodejs/documentation

Is the JS "hack" too much? While I think it's pretty solid, I think that at this point I'm ok with removing it if someone has concerns about it.

@eljefedelrodeodeljefe
Copy link
Contributor

Just general ones. Haven't made it to review yet. If you can avoid it it would be better....

@eljefedelrodeodeljefe
Copy link
Contributor

Since it is using vanilla and well supported JS, I'd be okay with having this now and hopefully removing this later.

this.scrollTop = e.deltaY > 0 ? this.scrollHeight : 0;
e.preventDefault();
}
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you go this route, may I suggest to throttle the listener to avoid horrible perfs janks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handler is pretty lightweight, I don't think it could cause any janks, except on maybe ancient hardware.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it still good practice to throttle it regardless?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on the use case. With throttling, some events won't get cancelled which results in scroll ticks going through. That's not something I want in this case, so every event would have to be cancelled.

@silverwind
Copy link
Contributor Author

silverwind commented May 11, 2016

Hmm, I think I'll drop the JS after all. It was just one user complaining about it, while probably more people agree to let the browser handle scrolling.

Moved the sidebar to a fixed position and moved the positioning of the
main content to the page's body, which results in back/forward
navigation through hash links and search highlight working again.

Fixes: nodejs#6637
Based on: nodejs#5716
@silverwind
Copy link
Contributor Author

Okay, CSS only change now to fix two issues. Please review!

@lpinca
Copy link
Member

lpinca commented May 11, 2016

I've tested this on Chrome and mobile Safari, all good 👍 .

@eljefedelrodeodeljefe
Copy link
Contributor

LGTM then

silverwind referenced this pull request May 15, 2016
Moved the sidebar to a fixed position and moved the main column to the
page's body, which results in back/forward navigation through hash
links and search highlight working again.

Fixes: #6637
Fixes: #6751
Based on: #5716
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com>
@silverwind silverwind closed this May 17, 2016
@silverwind
Copy link
Contributor Author

Landed in bef1ec0.

@silverwind silverwind deleted the doc-scrolling branch May 17, 2016 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: search indicators missing
5 participants