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

Next and previous buttons wrap and stack on mobile #918

Closed
jaril opened this issue Aug 27, 2018 · 10 comments
Closed

Next and previous buttons wrap and stack on mobile #918

jaril opened this issue Aug 27, 2018 · 10 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. status: claimed Issue has been claimed by a contributor who plans to work on it.

Comments

@jaril
Copy link
Contributor

jaril commented Aug 27, 2018

🚀 Feature

Changing the next and previous button styles so that they don't stack and wrap on smaller screens (either on desktop or mobile).

img_7537

Have you read the Contributing Guidelines on issues?

Yes

Motivation

The behavior happens when the text inside the buttons are long. This is especially noticeable on mobile, since it's easier to click on the wrong thing.

Pitch

Modify button styles for mobile screen widths.

  • Option 1: set both buttons to equal width on smaller screens, forcing the lengthy text to wrap within the button itself
  • Option 2: set the next button to float: left on smaller screens and add padding: 10px so that there's consistency and clear separation between the two buttons

option-comparison

@JoelMarcey JoelMarcey added bug An error in the Docusaurus core causing instability or issues with its execution mentorship difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. labels Aug 27, 2018
@JoelMarcey
Copy link
Contributor

@notjaril Thanks for the bug report. Do you have any interest in submitting a PR to fix this?

@jaril
Copy link
Contributor Author

jaril commented Aug 27, 2018

Sure! Which option do you prefer?

I'm leaning more towards option 2. Putting my UX hat on, it's more difficult to reach buttons on the right side of the screen on mobile (at least for right handed folks). Also it's a bonus that it's a simpler fix.

@JoelMarcey
Copy link
Contributor

@notjaril I like option 2 as well. 👍

@yangshun
Copy link
Contributor

Option 2 is great 👍 Sometimes we have extremely longer unbreakable strings because they are function names though, for example: https://facebook.github.io/react-native/docs/0.56/touchableopacity

Not sure how we can deal with that.

@yangshun yangshun added the status: claimed Issue has been claimed by a contributor who plans to work on it. label Aug 27, 2018
@yangshun
Copy link
Contributor

@notjaril it's yours!

I've added an "issue: claimed" label so that others will know not to start work on the issue. If you change your mind about the issue, no worries! Just let me know so that I can remove the label and free it up for someone else to claim.

I'll check in with you periodically so that we can keep the task updated with the progress.

@jaril
Copy link
Contributor Author

jaril commented Aug 27, 2018

@yangshun I've noticed the extremely long strings as well. It should be okay, since the current CSS handles that case just fine by wrapping the text within the button anyway.

aug-27-2018 17-34-28

@yangshun
Copy link
Contributor

Yes, it wraps for text which have spaces in them. In the example I posted above, there are no spaces in them because they're code (function names/component names). In this case, we could use something like text-overflow: ellipsis for truncation.

@jaril
Copy link
Contributor Author

jaril commented Aug 27, 2018

Oh I see what you're saying. Truncation is a good idea - though I just noticed that the arrows (← →) are part of the text, and the next arrow (→) would get cut off if the text were truncated.

I'm thinking we could make the arrows its own DOM element inline with the text, that way only the text gets truncated. Any thoughts on how to get around it?

I'll think about this more and circle back.

@yangshun
Copy link
Contributor

yangshun commented Aug 27, 2018

Cool. Yes we could move the → into its own span and only truncate the text

@jaril
Copy link
Contributor Author

jaril commented Aug 28, 2018

Okay - I had to add some logic but I think I've got it. Function/component names now truncate with ellipsis to 200px width for function/component names, where regular titles are simply wrapped. The arrows are in different spans so it's unaffected.

The distinction between the two cases is made by looking for a a smaller case character followed by an upper case character (eg aR/pR/eI). This seems to cover all of the function/component names within a library like React Native, except for (short) single words in which case it's simply wrapped like a regular title would.

If there are any other edge cases I might have missed with this let me know. Also if it's better to move the discussion over to the PR that's fine too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. status: claimed Issue has been claimed by a contributor who plans to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants