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

Buttons still overlap code #1322

Closed
jyn514 opened this issue Sep 9, 2020 · 8 comments · Fixed by #1806
Closed

Buttons still overlap code #1322

jyn514 opened this issue Sep 9, 2020 · 8 comments · Fixed by #1806
Labels
A-Style Area: Style (CSS, etc.)

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 9, 2020

Same as #389 but with an example from https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html#generic-lifetimes-in-functions:

image

This screenshot was taken on iOS with Safari 13.

You can also reproduce by zooming to 200% on desktop (although I don't expect anyone's browsing the book that way):

image

@serverwentdown
Copy link

What about instead of #1508, we add padding-right when the screen is too small so that there is enough padding to scroll left and right.

@joshxyzhimself
Copy link

I think possible approach is move the code downward by 1 line? So buttons have their own line?

@vwkd
Copy link

vwkd commented Nov 6, 2021

Another idea is to do it like GitHub. Hide the buttons by default. Show them on hover (desktop) and on single tap (mobile). Also give them a background.

Desktop

desktop

Mobile

mobile

@ehuss
Copy link
Contributor

ehuss commented May 17, 2022

I posted #1806 with a proposed fix.

I would appreciate if you could take a look and see if you have any thoughts. I posted a demo at https://ehuss.github.io/rust-book/. If you could look through some examples, try different browsers and platforms, different color themes, etc. If you have access to Android, that would particularly be nice to test since I don't have access to that.

@joshxyzhimself
Copy link

Screenshot_20220517-103540_Chrome

Screenshot_20220517-103553_Chrome

Screenshot_20220517-103654_Chrome

@joshxyzhimself
Copy link

Screenshot_20220517-103942_Chrome

Screenshot_20220517-103949_Chrome

@ehuss
Copy link
Contributor

ehuss commented May 24, 2022

Here's an attempt where the buttons only show on hover: https://ehuss.github.io/rust-book/hover/

On mobile safari, hover can be triggered by just tapping the code block. I'm guessing mobile chrome does the same?

I like the idea of making the buttons only show on hover. I think the buttons are generally distracting and not something I interact with often. It also seems that having a "Copy" button only show on hover is a more common pattern (such as on GitHub).

That being said, I'm not super happy with how it looks. I am not a designer, but they feel a little clunky now. Any thoughts?

@jyn514
Copy link
Member Author

jyn514 commented May 24, 2022

On mobile safari, hover can be triggered by just tapping the code block. I'm guessing mobile chrome does the same?

mobile chrome is very bad about hover interactions, you usually have to tap and hold the block and the timing is hard to get right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Style Area: Style (CSS, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants