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: Titles of long function names in API Reference truncated and horizontal scroll bar in code examples in 3 column layout #20635

Open
DietBru opened this issue May 3, 2024 · 8 comments
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org

Comments

@DietBru
Copy link
Contributor

DietBru commented May 3, 2024

As shown in the bottom portion of the screenshot below, the HTML documentation does not use the full window width of the browser. For some titles, the default width is not enough (red square in screenshot). Adding the following lines to the file doc/source/_static/scipy.css

.bd-main .bd-content .bd-article-container {
  max-width: 100%;  /* default is 60em */
}
.bd-page-width {
  max-width: 100%;  /* default is 88rem */
}

lets the center column use the full width (top portion of screenshot). Details can be found in the pydata-sphinx-theme docs.
image

@DietBru DietBru added the Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org label May 3, 2024
@ilayn
Copy link
Member

ilayn commented May 3, 2024

This might have other consequences though. In particular, using full page has a potential readability issue https://baymard.com/blog/line-length-readability

If this is not a very common problem, probably good thing is to leave it alone.

@melissawm
Copy link
Contributor

melissawm commented May 3, 2024

I think we can experiment with maybe not 100% but something larger than the default. For information, this is where the page width comes from: https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/layout.html#horizontal-spacing

(I just realized you had already linked it @DietBru 🤦🏻‍♀️ sorry!)

@DietBru
Copy link
Contributor Author

DietBru commented May 4, 2024

This might have other consequences though. In particular, using full page has a potential readability issue https://baymard.com/blog/line-length-readability

I would argue that the recommended <75 character margin widths are plausible for longer chunks of continuous texts but not necessarily for the function style reference of SciPy, because:

  • Paragraphs tend to be very short and are often indented as well. Hence, there is additional layout structure for the eyes to not get lost within the paragraph.
  • The user may adjust the window width or respective window font size to their personal preference. The text flow will adapt automatically. Fixed narrow margins just vary the white space of the borders.
  • Function references are frequently not read from top to bottom but are skimmed. Hence, seeing a larger portion without scrolling is beneficial, in my opinion.
  • That this recommendation is not valid for all circumstances can be seen by looking at the image captions at https://baymard.com/blog/line-length-readability — there the text spans the full width of the image.

If not allowing full width marigns, increasing them by a little bit would already be beneficial: Code examples, like in special.airye display only 74 characters per line though the code is 80 characters wide. Hence, manual horizontal scrolling is needed. The Contributor Guide on the other hand suggests a maximum width of 88 characters.

@ilayn
Copy link
Member

ilayn commented May 4, 2024

The regular users won't have any problem with any width, they can just like or get annoyed. The readability is for the impaired and folks with dyslexia and alike who have issues with "returning the carriage to the newline". Also, letting user adjust window size for readability is a no-no for frontend. Here is another example

image

But anyways, I'm not knowledgeable or passionate enough to defend any position about it.

@DietBru
Copy link
Contributor Author

DietBru commented May 10, 2024

But anyways, I'm not knowledgeable or passionate enough to defend any position about it.

To make progress on this topic, let's try focus on the layout problems at hand to perhaps find a better solution (I changed the issue title accordingly):

  1. Long function/class names title truncated: if the function name is longer than ≈41 charachters, e.g., scipy.interpolate.CloughTocher2DInterpolator, its title will be truncated. The same thing happens in the top and bottom navigation entries. A solution would be to not include to module name, i.e, only use CloughTocher2DInterpolator there.
  2. Code examples are only 74 characters wide (without >>> only 70 char.) though the Contributor Guide suggests 88 characters. A solution would to increase width of those boxes by 25% (or the width of columns int API reference). For reference: the width of this Github comment block is ≈119 characters wide.

Note these issues appear only if the browser window is wide enough to have a three column layout. For narrower browser windows, the one- and two column layout has more characters per line.

@DietBru DietBru changed the title DOC: Use full page width for HTML documentation DOC: Titles of long function names in API Reference truncated and horizontal scroll bar in code examples in 3 column layout May 10, 2024
@ilayn
Copy link
Member

ilayn commented May 10, 2024

Both are OK with me.

For item 1 probably not truncating the breadcrumbs is a better solution so that the context is obvious.

@melissawm
Copy link
Contributor

Thanks for thee discussion folks. I am going to loop in accessibility people who can maybe help us evaluate the best decision here.

@asmeurer
Copy link

Why not just wrap the header text? This is what the Furo theme does, for example. I'm not a CSS expert, but you might even be able to use something like <wbr> to make it wrap on the dot instead of the middle of the function name (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_text/Wrapping_breaking_text#the_wbr_element).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org
Projects
None yet
Development

No branches or pull requests

4 participants