Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Underline links for readability and a11y#160

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pradyunsg merged 3 commits intopython:mainfromhugovk:underline-links
Dec 20, 2023

Conversation

hugovk
Copy link
Member

@hugovkhugovk commentedOct 18, 2023
edited
Loading

Currently this theme changes the colour of hyperlinks but doesn't underline them.

For example:https://docs.python.org/3/whatsnew/3.12.html

image

When hovering over a link, it changes colour and a link is shown (see "f-strings" here):

image

However, links should always be underlined. This improves accessibility and also readability.

For example:

Not using underlines also fails a WCAG check:

And GitHub have just enabled underlines:

Demo

https://python-docs-theme-previews--160.org.readthedocs.build/en/160/whatsnew/3.12.html

imageimage

@ncoghlan
Copy link
Contributor

@hugovk I was about to hit merge on this, but then I wondered: Should we tag it for backport to the active maintenance branches as well?

Personally, I'm not seeing a downside to doing that, and a whole lot of benefits.

@hugovk
Copy link
MemberAuthor

@ezio-melotti
Copy link
Member

ezio-melotti commentedOct 19, 2023
edited
Loading

I find the screenshot with underlines "noisier" than the current one, and I suspect the underlines were not added to the docs' theme in the first place for similar reasons. Wikipedia also doesn't have underlines and cites possible confusion when a link contains underscores (it might have a setting to still enable underlines though).

Given that both our docs and Wikipedia are rich in links, and that -- especially for our docs -- there are often underscores in the text of the links, do the guidelines that suggest adding underlines still apply?

For reference, here are a couple of examples of underlined links that contain underscores:
image
image

Perhaps the contrast could be tweaked instead, or a lighter/different (e.g. dotted) underline could be used instead? Another solution could be to do like GitHub did and add them as an option, but that requires more work.

@hugovk
Copy link
MemberAuthor

Good point, let's consider narrowing/lowering the underline, and see how GitHub and MDN do it.

@hugovkhugovk marked this pull request as draftOctober 19, 2023 16:38
@hugovk
Copy link
MemberAuthor

hugovk commentedNov 4, 2023
edited
Loading

Updated to make the underline thinner, move it down a bit, and also increase the line height so it better fits in the gap.

"Line height (line spacing) to at least 1.5 times the font size" is also one of the WCAG 2.1 guidelines, and improves accessibility through readability.

https://www.w3.org/WAI/WCAG21/Understanding/text-spacing.html

Here's how the earlier snippets with underscores look:

imageimage

And from What's New in 3.13:

image

And from What's New in 3.12:

image

How does this look?

@ezio-melotti
Copy link
Member

ezio-melotti commentedNov 4, 2023
edited
Loading

This is definitely better and solves the potential confusion with underscores. I'm now -0 (from -1) on this since I still prefer the version without underlines, but if others prefer the underlines I'm fine with the change.

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
@hugovkhugovk marked this pull request as ready for reviewNovember 12, 2023 11:41
@pradyunsgpradyunsg merged commitd1e6df4 intopython:mainDec 20, 2023
@hugovkhugovk deleted the underline-links branchDecember 20, 2023 15:55
@hugovkhugovk mentioned this pull requestJan 27, 2024
@egeakman
Copy link

egeakman commentedJan 29, 2024
edited
Loading

Hi there@hugovk. Is there Discourse discussion for this? I believe there should be a discussion first. I would like to hear people's opinions.

@hugovk
Copy link
MemberAuthor

There wasn't a discussion for this, just this PR that was open for two months before merge, and one month before release.

This was prompted by GitHub recentlyadding underlines for accessibility. In addition to approvals here, core devs were in support (on Discord), and some said underlines help with poor eyesight or colourblindness.

Some references:

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ezio-melottiezio-melottiezio-melotti left review comments

@ncoghlanncoghlanncoghlan approved these changes

@pradyunsgpradyunsgpradyunsg approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@hugovk@ncoghlan@ezio-melotti@egeakman@pradyunsg

[8]ページ先頭

©2009-2025 Movatter.jp