WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Can you remove link underlines and focus indicators in PDF documents?

for

From: Steve Green
Date: Feb 14, 2025 1:14AM


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