The Wayback Machine - https://web.archive.org/web/20210707035937/https://github.com/facebook/docusaurus/issues/3513
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back to top button #3513

Open
lex111 opened this issue Oct 1, 2020 · 14 comments 路 May be fixed by #4912
Open

Back to top button #3513

lex111 opened this issue Oct 1, 2020 · 14 comments 路 May be fixed by #4912

Comments

@lex111
Copy link
Collaborator

@lex111 lex111 commented Oct 1, 2020

馃殌 Feature

Feature request from Canny:

I think the back to top button in the v1 should be also implemented in v2. Long docs will need it.

Have you read the Contributing Guidelines on issues?

Yes

Motivation

Many docs sites have a back to top button. Docusaurus v1 also had similar built-in feature. This is especially useful for long web pages.

Pitch

  • Better backward compatibility from v1
  • Nice UX improvement
@lex111
Copy link
Collaborator Author

@lex111 lex111 commented Oct 1, 2020

We need to think about how this button will look like and where to place it on the web page. Any options?

@michaelknowles
Copy link

@michaelknowles michaelknowles commented Oct 1, 2020

The original design from v1 seems like a good start. Are there other ideas?

@lex111
Copy link
Collaborator Author

@lex111 lex111 commented Oct 1, 2020

Design this button based from v1 is not mobile-friendly on v2.

image

@michaelknowles
Copy link

@michaelknowles michaelknowles commented Oct 1, 2020

We could place the button above or to the side of the hamburger.

To the side seems like a good option since the hamburger will already be obscuring any text on this horizontal row. Placing it above will mean another row of text is obscured.

Putting it as an option inside the hamburger doesn't sound great because I think scroll to top probably shouldn't take an extra click to get to.

@slorber
Copy link
Collaborator

@slorber slorber commented Oct 1, 2020

It's worth mentioning this other issue: #2220

As users are not totally satisfied with the current mobile layout/navigation, we should think about what design we really want first, and where the back to top button would fit in this fixed design.

@Sayan-dev
Copy link

@Sayan-dev Sayan-dev commented Oct 2, 2020

What if the back-to-top button is visible when the user is scrolling up...instead of the hamburger button and stays for few seconds, and gets hidden if the user doesnot scroll up or scrolls down. Aso I didnot see any hamburger button in mobile view
If like my idea...i can start working

@michaelknowles
Copy link

@michaelknowles michaelknowles commented Oct 3, 2020

@slorber OK, I'll continue discussion on that issue.

@hamzahamidi
Copy link
Contributor

@hamzahamidi hamzahamidi commented Oct 13, 2020

I think the Back to top button should only be visible when scrolling.

@vickywane
Copy link

@vickywane vickywane commented Oct 15, 2020

@lex111 @michaelknowles i could fix this by adding a round opaque arrow ( up or down) icon to scroll to the top.

If we are worried about it obscuring other content, the button could be made to fade out on the screen after few seconds of inactivity using scrollEventListeners.

I would like to implement this.

@EricAtMSFT
Copy link

@EricAtMSFT EricAtMSFT commented Oct 16, 2020

I have a simple prototype working in my fork here: https://github.com/EricAtMSFT/docusaurus

I tried a few things and landed on the button being inline, materializing after 400px of vertical scrolling, displayed as a small overlay on the content so as to not disrupt the sometimes long side bar content. It has a gradient to make it less noticeable. On mobile it snaps to align with the Hamburger button on the bottom left.

Feedback welcome for iteration!

image

Update. Added small arrow image to accompany link.
image

@Vishal19111999
Copy link

@Vishal19111999 Vishal19111999 commented Dec 12, 2020

@lex111 Putting the "scroll to top" button along with the hamburger not only covers the screen but, it would be frustrating if someone clicked "scroll to top" instead of hamburger by accident

How about using something with the same hamburger, like holding the hamburger or swiping it or anything similar? as it would resolve both the issues I implemented correctly!

To say the very least, it can be a good silent temporary fix!

I can work on this if it sounds good!

(I am just a beginner, so ignore any mistakes)

Group 420

@Rahulm2310
Copy link

@Rahulm2310 Rahulm2310 commented Feb 8, 2021

Is this issue available? I would like to help. Thanks 馃檪

@slorber
Copy link
Collaborator

@slorber slorber commented Feb 8, 2021

@Rahulm2310 I think we should not implement this feature until we have a clear idea what the UX on mobile should be => #2220

(if we did, it would only be temporary, so if you have a nice temporary solution to suggest, why not, but we may not keep it in the long term)

@technikhil314
Copy link

@technikhil314 technikhil314 commented Apr 18, 2021

I too would like to help on this.

And regarding the proposed solution by @Vishal19111999. I feel the long press can still be achieved with fair and less amount of code. But drag thing might ask for a big chunk of code that is well tested on all touch and pointing devices because drag + touch control is still fleky in many browsers IMO.

Plus that experience is not widely used for any user to implicitly know it (What I actually mean is user cant find on their own that there is a back to top button available on long press of docs side bar open button. We might have to instruct them about this feature well in advance.

How about showing back to top just above close docs sidebar only when sidebar is open. Sorry I am bad at overall painting for all my life. But I hope this conveys my thoughts.

Screenshot 2021-04-18 at 11 15 50 PM

And yes I too am new to this community and in fact this would be my first ever contribution here.
So please correct me if I am wrong anywhere.

@lex111 lex111 linked a pull request that will close this issue Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment