Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now
Underline text links in markdown
## Problem In order to satisfy [WCAG 2.1 1.4.3 Contrast (Minimum)](https://www.w3.org/TR/WCAG21/#contrast-minimum) (Level AA) text links must a) have at least a 3:1 contrast ratio with surrounding text, and b) have a 4.5:1 contrast ratio against the background. As it relates to using color alone as the differentiator, the available palette that satisfies the requirements is [extremely limited](https://www.w3.org/TR/2008/NOTE-WCAG20-TECHS-20081211/working-examples/G183/link-contrast.html), so there has to be another non-color indicator for these links. ## Solution Underline text links. Underlines don’t have to simply use `text-decoration: underline` either. The following gif from this [CodePen example](https://codepen.io/lostsatellites/pen/zQLXvd) explores a few different methods. ![CleanShot_2020-12-03_at_09.39.21](/uploads/50bf466b7da95537bfdd70f665d01732/CleanShot_2020-12-03_at_09.39.21.gif) Here are examples using the default underline. | **Before** | **After** | | ------ | ------ | | ![CleanShot_2020-12-03_at_09.56.38_2x](/uploads/7c1a7bc5e9f59fd32b0013d6f6676a3f/CleanShot_2020-12-03_at_09.56.38_2x.png) | ![CleanShot_2020-12-03_at_09.54.55_2x](/uploads/edbfbd2be906136fe879d560250595fb/CleanShot_2020-12-03_at_09.54.55_2x.png) | | ![CleanShot_2020-12-03_at_10.02.25_2x](/uploads/e55ce975960e06db74eb67a6637828ae/CleanShot_2020-12-03_at_10.02.25_2x.png) | ![CleanShot_2020-12-03_at_10.06.52_2x](/uploads/4d61a3195bcb4f3d1ab459f79dff7e9e/CleanShot_2020-12-03_at_10.06.52_2x.png) | | ![CleanShot_2020-12-03_at_10.10.17_2x](/uploads/40619da472748ff3d43a86f1ce0e5267/CleanShot_2020-12-03_at_10.10.17_2x.png) | ![CleanShot_2020-12-03_at_10.12.09_2x](/uploads/546f01c5f27ee99a3526e8d26d7f8694/CleanShot_2020-12-03_at_10.12.09_2x.png) | | ![CleanShot_2020-12-03_at_09.46.07_2x](/uploads/13170b35d15cb32acaa389cbd5ee4e14/CleanShot_2020-12-03_at_09.46.07_2x.png) | ![CleanShot_2020-12-03_at_09.50.28_2x](/uploads/b0f2ed6e17f9e00e070c8b1889138117/CleanShot_2020-12-03_at_09.50.28_2x.png) | ### What user problem(s) does this solve? - Highlights actionable items and references within issuable descriptions, discussions, and wikis. - Allows links to stand out for users who may have trouble seeing them due to small text and/or low contrast. This isn’t always related to a visual deficiencies either. It can be from viewing the screen outside or with glare, or when the user has high-contrast mode on in their system. - Satisfies WCAG 2.1 1.4.3 Contrast (Minimum) (Level AA) which moves the product closer to fuller compliance. ### Out of scope - Content and elements or components not created with markdown. - Inline elements that already have different styles. For example, linked usernames or inline code blocks that contain links. - Inline labels. ### Current limitations - The typography styles and typescales from Pajamas are not implemented into the product. Doing so will be a large undertaking so a possible solution would be to include this change in Pajamas, and separately address in the product’s current state. ## Resources - [Link Contrast Checker](https://webaim.org/resources/linkcontrastchecker/) - [WCAG 2.0 and Link Colors](https://webaim.org/blog/wcag-2-0-and-link-colors/) - [How to meet Contrast (Minimum)](https://www.w3.org/WAI/WCAG21/quickref/#contrast-minimum) - [Underlines are Beautiful](https://adrianroselli.com/2019/01/underlines-are-beautiful.html) --- /cc @gitlab-com/gitlab-ux/ux-foundations @mikegreiling
issue