E-mail List Archives
Re: Can you remove link underlines and focus indicators in PDF documents?
From: Steve Green
Date: Feb 18, 2025 10:10AM
- Next message: Gopinathan Natesan: "Query on Zoom Testing in Mobile Browser"
- Previous message: Philip Kiff: "Re: Can you remove link underlines and focus indicators in PDF documents?"
- Next message in Thread: None
- Previous message in Thread: Philip Kiff: "Re: Can you remove link underlines and focus indicators in PDF documents?"
- View all messages in this Thread
If anyone else didn’t receive the test file and would like it, please contact me off-list.
The text colour does not affect the focus indicator colour, so a high contrast link may well have a low contrast focus indicator. Passing the test for text contrast tells you nothing about the focus indicator contrast.
In Chrome, you are seeing the same dotted black outline that I see in Edge, which makes sense. I just checked on another machine, and that also has a dotted black outline in Chrome. The first machine has Acrobat as the default PDF reader, which may account for the difference, although I don’t know why it would.
Steve
From: Philip Kiff < <EMAIL REMOVED> >
Sent: 18 February 2025 16:10
To: WebAIM Discussion List < <EMAIL REMOVED> >
Cc: Steve Green < <EMAIL REMOVED> >
Subject: Re: [WebAIM] Can you remove link underlines and focus indicators in PDF documents?
That is super interesting to me, Steve!
Thanks so much for taking the time to figure out how the algorithm in Adobe Reader works, explaining it to the list, and for sharing the test file (which I received off-list because you cc'd me - the mailing list otherwise strips out attachments, I think).
I guess I've never actually carefully thought about - or even carefully observed (!) - the differences in how focus colour and background colour interact with link colour in different PDF software readers.
In the sample links in the PDF you sent, I notice that most (or all?) cases of colour contrast failures for focus indicator vs background, the link text itself would also fail to meet colour contrast minimums for standard foreground vs background text. So perhaps - at least with Adobe Reader - the current algorithm should lead to a focus indicator that meets minimum colour contrast guidelines, provided that your link text itself also does?
Also, while checking the PDF viewers in Firefox and Chrome just now, I don't see the "dual colour" black and white focus indicator in Chrome? I do see a dual colour indicator in Firefox, with black then white outlines, which as you say, will force the focus to become visible regardless of background. When I tried to test in Chrome, all I seem to be getting is a dotted black focus indicator, which remains the same colour regardless of background colour. And which is therefore entirely invisible against a black background. Though maybe my browser/system dark mode/accessibility settings are affecting Chrome's display. I'm testing with Windows 11, Chrome 133.0.6943.99 64-bit.
Like I say, this is all new learning for me, and very interesting, thanks.
Phil.
On 2025-02-14 3:14 a.m., Steve Green via WebAIM-Forum wrote:
Adobe Reader automatically sets the colour of the focus indicator based on the link's background colour. This could have worked really well, but they created an incredibly stupid algorithm for doing it. The result is that in terms of WCAG conformance, the focus indicator has sufficient colour contrast against some background colours but not against others. Fortunately, you can choose background colours that you know will have sufficient contrast.
The algorithm is very simple. They simple deduct the hex colour of the background from #FFFFFF to get the focus indicator colour. If the background is #E26B0A (which is a dark orange), the focus indicator will be #1D94F5, which gives a colour contrast ratio of 1.04 so the focus indicator is virtually invisible. But if the background is #FFCC99 (which is a light orange), the focus indicator is #003366, giving a contrast ratio of 8.62.
I have attached a test file containing a variety of background colours that I used to verify the algorithm works the way I described above.
It's worth noting that Adobe Reader calculates the focus indicator colour for individual dots in its dotted outline. The result is that some parts of the focus indicator colour will be different from other parts if the link overlays an irregular background colour such as a gradient or an image. In marginal situations, this increases the chance of at least some of focus indicator having sufficient contrast.
Of course, other PDF readers will apply different focus indicator colours. In the Edge browser, the focus indicator colour varies between pure black and almost pure black depending on the background colour, so it is non-conformant against many background colours and is even worse than Adobe Reader.
Chrome uses its dual colour black and white focus indicator, so it has sufficient colour contrast against all background colours. Likewise, Firefox uses its dual colour blue and white focus indicator.
Steve Green
Managing Director
Test Partners Ltd
- Next message: Gopinathan Natesan: "Query on Zoom Testing in Mobile Browser"
- Previous message: Philip Kiff: "Re: Can you remove link underlines and focus indicators in PDF documents?"
- Next message in Thread: None
- Previous message in Thread: Philip Kiff: "Re: Can you remove link underlines and focus indicators in PDF documents?"
- View all messages in this Thread