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

x/pkgsite: code block scroll-in-scroll #45073

Closed
BourgeoisBear opened this issue Mar 17, 2021 · 10 comments
Closed

x/pkgsite: code block scroll-in-scroll #45073

BourgeoisBear opened this issue Mar 17, 2021 · 10 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development pkgsite UX Issues that involve UXD/UXR input

Comments

@BourgeoisBear
Copy link

What is the URL of the page with the issue?

https://pkg.go.dev/robpike.io/ivy

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36

Screenshot

image

What did you do?

Trying to read the syntax documentation of Rob Pike's ivy. The scroll-in-scroll of tall code blocks is painful. A single set of scrollbars would be preferable:

image

@gopherbot gopherbot added this to the Unreleased milestone Mar 17, 2021
@jba jba added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 17, 2021
@jba jba modified the milestones: Unreleased, pkgsite/unplanned Mar 17, 2021
@jamalc
Copy link

jamalc commented Apr 29, 2021

/cc @fflewddur @Joanne881107 for UX input

@jamalc jamalc added the UX Issues that involve UXD/UXR input label Apr 29, 2021
@jinhongy
Copy link

Totally agreed that scroll-in-scroll of tall code blocks is painful. A few options here:

  1. Since we do not have other horizon scrolling needs other than the code snippet, we can use the browser horizon scrolling for the code snippet as a quick fix.
  2. As an UI enhancement, we can also consider enabling pop up the code in a full screen layer as an alternative option. Example here:
    Example

@BourgeoisBear
Copy link
Author

@Joanne881107 personal preference would be #1 as a permanent solution. Simple, standard, and no accidental pop-ups from my touchpad.

@fflewddur
Copy link

I think we can and should avoid the need for visitors to do anything (either horizontal scrolling or viewing a pop up / overlay) in order to view this documentation. When the browser width is < 975px, we currently condense the details and outline, allowing the documentation to fill the full browser width. Above 975px, we immediately enable both the left and right sidebars. I suggest we add a third state, where the details sidebar continues to use the condensed horizontal view, and only switch to the 3-column layout when the center column will still be wide enough to display ~90 characters in preformatted boxes (which is what is causing the horizontal scrolling here).

The 90 character limit is arbitrary; it might be worth doing an analysis on the documentation corpus to identify a limit that matches current practices, but anything between 80-100 seems reasonable to me.

@fflewddur
Copy link

I think the above approach would also help with #44172.

@BourgeoisBear
Copy link
Author

BourgeoisBear commented Apr 29, 2021

@fflewddur

Not getting much value out of the 3rd column. Most of it is empty. If it's there just to aid in tracking the text, could just cap the width per-paragraph instead of the entire div.

Letting the code blocks be as wide as they need to be (instead of scroll-in-scroll, or wrapping) would be a better experience IMHO.

image

@fflewddur
Copy link

fflewddur commented Apr 30, 2021

@BourgeoisBear I like the idea of letting the the code blocks run longer than they currently do, but we're trying to balance that with the width of non-code text, which does need a max width to support readability. So, even if there was no third column, we would still want to limit the maximum line length for regular text. If it's technically feasible to allow <pre> blocks to run longer than regular text, that's a design worth exploring. Thanks for the suggestion!

@BourgeoisBear
Copy link
Author

BourgeoisBear commented Apr 30, 2021

@fflewddur, I made a mock-up using the developer console:

image

Two columns instead of three, 2nd w/ width=auto, put max width on <p>, leave <pre> sized to content.

The serif font is from my browser style overrides. I think it reads easier than sans-serif, but that is an artifact, not a request.

@jamalc
Copy link

jamalc commented Jun 23, 2021

We are testing out layout changes on the beta site to address this issue. See https://beta.pkg.go.dev/robpike.io/ivy.

@jamalc
Copy link

jamalc commented Jul 14, 2021

These changes are now live.

@jamalc jamalc closed this as completed Jul 14, 2021
@hyangah hyangah added the pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development label May 20, 2022
@rsc rsc unassigned jamalc Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development pkgsite UX Issues that involve UXD/UXR input
Projects
None yet
Development

No branches or pull requests

8 participants