Addressing Accessibility Concerns With Using Fluid Type<\/h1>\nMaxwell Barvian<\/address>\n 2023-11-07T18:00:00+00:00
\n 2024-10-14T15:35:03+00:00
\n <\/header>\n
You may already be familiar with the CSS clamp()<\/code> function. You may even be using it to fluidly scale a font size based on the browser viewport. Adrian Bece demonstrated the concept in another Smashing Magazine article<\/a> just last year. It\u2019s a clever CSS \u201ctrick\u201d<\/a> that has been floating around for a while.<\/p>\nBut if you\u2019ve used the clamp()<\/code>-based fluid type technique yourself, then you may have also run into articles that offer a warning about it. For example, Adrian mentions this<\/a> in his article:<\/p>\n\u201cIt\u2019s important to reiterate that using rem<\/code> values doesn\u2019t automagically make fluid typography accessible for all users; it only allows the font sizes to respond to user font preferences. Using the CSS clamp<\/code> function in combination with the viewport units to achieve fluid sizing introduces another set of drawbacks<\/strong> that we need to consider.\u201d<\/p><\/blockquote>\nHere\u2019s Una Kravets with a few words<\/a> about it on web.dev:<\/p>\n\u201cLimiting how large text can get with max()<\/code> or clamp()<\/code> can cause a WCAG failure under 1.4.4 Resize text (AA)<\/a>, because a user may be unable to scale the text to 200% of its original size. Be certain to test the results with zoom<\/a>.\u201d<\/p><\/blockquote>\nTrys Mudford also has something to say about it in the Utopia blog<\/a>:<\/p>\n\u201cAdrian Roselli<\/a> quite rightly warns that clamp can have a knock-on effect on the maximum font-size when the user explicitly sets a browser text zoom preference. As with any feature affecting typography, ensure you test thoroughly<\/strong> before using it in production.\u201d<\/p><\/blockquote>\nMudford cites Adrian Roselli, who appears to be the core source<\/a> of the other warnings:<\/p>\n\u201cWhen you use vw<\/code> units or limit how large text can get with clamp()<\/code>, there is a chance a user may be unable to scale the text to 200% of its original size. If that happens, it is WCAG failure under 1.4.4 Resize text (AA)<\/a> so be certain to test the results with zoom.\u201d<\/p><\/blockquote>\nSo, what\u2019s going on here? And how can we address any accessibility issues so we can keep fluidly scaling our text? That is exactly what I want to discuss in this article. Together, we will review what the WCAG guidelines say to understand the issue, then explore how we might be able to use clamp()<\/code> in a way that adheres to WCAG Success Criterion (SC) 1.4.4.<\/p>\n\n
\n 2024-10-14T15:35:03+00:00
\n <\/header>\n
clamp()<\/code> function. You may even be using it to fluidly scale a font size based on the browser viewport. Adrian Bece demonstrated the concept in another Smashing Magazine article<\/a> just last year. It\u2019s a clever CSS \u201ctrick\u201d<\/a> that has been floating around for a while.<\/p>\nBut if you\u2019ve used the clamp()<\/code>-based fluid type technique yourself, then you may have also run into articles that offer a warning about it. For example, Adrian mentions this<\/a> in his article:<\/p>\n\u201cIt\u2019s important to reiterate that using rem<\/code> values doesn\u2019t automagically make fluid typography accessible for all users; it only allows the font sizes to respond to user font preferences. Using the CSS clamp<\/code> function in combination with the viewport units to achieve fluid sizing introduces another set of drawbacks<\/strong> that we need to consider.\u201d<\/p><\/blockquote>\nHere\u2019s Una Kravets with a few words<\/a> about it on web.dev:<\/p>\n\u201cLimiting how large text can get with max()<\/code> or clamp()<\/code> can cause a WCAG failure under 1.4.4 Resize text (AA)<\/a>, because a user may be unable to scale the text to 200% of its original size. Be certain to test the results with zoom<\/a>.\u201d<\/p><\/blockquote>\nTrys Mudford also has something to say about it in the Utopia blog<\/a>:<\/p>\n\u201cAdrian Roselli<\/a> quite rightly warns that clamp can have a knock-on effect on the maximum font-size when the user explicitly sets a browser text zoom preference. As with any feature affecting typography, ensure you test thoroughly<\/strong> before using it in production.\u201d<\/p><\/blockquote>\nMudford cites Adrian Roselli, who appears to be the core source<\/a> of the other warnings:<\/p>\n\u201cWhen you use vw<\/code> units or limit how large text can get with clamp()<\/code>, there is a chance a user may be unable to scale the text to 200% of its original size. If that happens, it is WCAG failure under 1.4.4 Resize text (AA)<\/a> so be certain to test the results with zoom.\u201d<\/p><\/blockquote>\nSo, what\u2019s going on here? And how can we address any accessibility issues so we can keep fluidly scaling our text? That is exactly what I want to discuss in this article. Together, we will review what the WCAG guidelines say to understand the issue, then explore how we might be able to use clamp()<\/code> in a way that adheres to WCAG Success Criterion (SC) 1.4.4.<\/p>\n\n