Skip to content

rustdoc: #13771: Make html links inside paragraphs more readable #13807

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

Merged
merged 1 commit into from
Apr 29, 2014
Merged

rustdoc: #13771: Make html links inside paragraphs more readable #13807

merged 1 commit into from
Apr 29, 2014

Conversation

ipetkov
Copy link
Contributor

@ipetkov ipetkov commented Apr 27, 2014

All links inside docblocks will have their color set to #4e8bca (a light blue color to contrast against the black text). This color also offers a visible contrast from the surrounding text if viewed as grayscale, making it suitable for accessability.

Docblock links will also be underlined when hovered over.

Before:
screen shot 2014-04-27 at 12 47 06 pm

After (links underlined only on hover, cursor not shown in image):
screen shot 2014-04-27 at 12 47 48 pm

Fix #13771

@adrientetar
Copy link
Contributor

Can you underline only on hover?

@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 27, 2014

Sure!

Updated and rebased

@lifthrasiir
Copy link
Contributor

@adrientetar Uh, then we would have only the color to distinguish links and it is bad for accessibility. I think we need underlines at least in the docblock area.

@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 28, 2014

@lifthrasiir what about bolding links like the previous docs did? If so, should another color be used or would that be enough?

@adrientetar
Copy link
Contributor

@lifthrasiir Do you have something concrete backing this? MSDN shows that color-recognition deficiencies still let the people see blue.
So which kind of deficiencies are we talking about? I had an economics teacher that had major vision problems and he would require us to write in black and had a special kind of magnifying glass with white lighting. I assume people with major vision deficiencies use a screen reader, otherwise a CSS injection plugin will override styles conveniently (e.g., Stylish for Firefox).

I don't see any concrete evidence of cases where someone would a/ not see the blue color and b/ not have any software alternative available that would not require a mandatory edit to the mainline stylesheet – otherwise they would not be able to browse most modern websites (GitHub here included) (?). Bootstrap does not underline links and has a committance towards accessibility, the accessibility plugin itself does not add mandatory underline either...

Underlining is being phased out is modern websites because it halts the document flow, much more than a color change does.
If there was a case of both a/ and b/ above being fulfilled then sure I would be backing always-on underlining, but there does not seem to be one afaict.

@lifthrasiir
Copy link
Contributor

@adrientetar Right, using the color and nothing else itself is not a problem. It is a problem that using the color which doesn't have enough contrast from the surrounding text. (And there are certainly people who cannot distinguish hues at all.) My initial comment is based on the fact that @ipetkov's screenshot doesn't seem to have enough contrast when grayscaled.

Some concrete numbers: WCAG 2.0 Level AA requires at least 3:1 contrast for most visual cues (it's actually 4.5:1 except for large texts, but for the purpose of this discussion let's think it as an absolute minimum). The PR uses #333333 for text and #4d76ae for link, yielding the contrast ratio of 2.72:1 (you can verify it with a checker). For comparison Bootstrap seems to use #333333 for text and #4e8bca for link, yielding the ratio of 3.53:1. Of course this greatly depends on the actual color space and gamma, and color-blind users would certainly use a high-contrast configuration.

Well, this seems to suggest that one can meet the basic accessibility by simply making the link color slightly lighter. What do you think about this?

Note: We should also eventually think about other visual cues for the accessibility.

@adrientetar
Copy link
Contributor

Yup no problem about making it lighter.

@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 28, 2014

Bootstrap's #4e8bca color for links definitely offers better contrast on a grayscale, and it is aesthetically similar to the current one.

@lifthrasiir and @adrientetar do you think this is acceptable?

#4e8bca for link color:
screen shot 2014-04-28 at 9 13 58 am

Grayscale:
screen shot 2014-04-28 at 9 13 58 am 2

@adrientetar
Copy link
Contributor

It's fine by me.

@lifthrasiir
Copy link
Contributor

Yeah, it looks definitely better.

@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 28, 2014

Should links be underlined on hover?

The old doc style did not do this, but GitHub for example does show underlines on hover.

@adrientetar
Copy link
Contributor

Standalone documentation does it but it's mostly a leftover from Bootstrap. Do not have a strong bias with this.

All links inside docblocks will have their color set to `#4e8bca` (a
light blue color to contrast against the black text). This color also
offers a visible contrast from the surrounding text if viewed as
grayscale, making it suitable for accessability.

Docblock links will also be underlined when hovered over.
@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 29, 2014

Updated once more

bors added a commit that referenced this pull request Apr 29, 2014
All links inside docblocks will have their color set to `#4e8bca` (a light blue color to contrast against the black text). This color also offers a visible contrast from the surrounding text if viewed as grayscale, making it suitable for accessability.
    
Docblock links will also be underlined when hovered over.

Before:
![screen shot 2014-04-27 at 12 47 06 pm](https://cloud.githubusercontent.com/assets/1638690/2812157/00e53a32-ce45-11e3-81e8-7b1dc692f6b7.png)



After (links underlined only on hover, cursor not shown in image):
![screen shot 2014-04-27 at 12 47 48 pm](https://cloud.githubusercontent.com/assets/1638690/2812158/04fa94b4-ce45-11e3-9ead-2344753c251d.png)

Fix #13771
@bors bors closed this Apr 29, 2014
@bors bors merged commit 3a0d8fd into rust-lang:master Apr 29, 2014
bors added a commit that referenced this pull request Apr 30, 2014
Two selector fixes for rustdoc:

- links colored in blue (#13807) was also affecting headers, which are anchored to their respective ids
- the header unstyling from #13776 was being applied to all headers also

Additionally, remove a stray title in the documentation. This makes the crate title of prelude appear as header instead of an inline paragraph of text (all others work normally and do not have that header tag).

The design is unchanged from my previous template (e.g. [here](http://adrientetar.legtux.org/cached/rust-docs/struct.CChars.htm)), however it is now properly applied.  
The last fix remaining is to enable webfonts service from `static.rust-lang.org`, this is #13593.

r? @alexcrichton, @brson
@ipetkov ipetkov deleted the issue-13771 branch June 16, 2014 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustdoc's in-paragraph links do not look like links.
4 participants