Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContrastChecker: audit font size logic #8614

Closed
afercia opened this issue Aug 6, 2018 · 0 comments
Closed

ContrastChecker: audit font size logic #8614

afercia opened this issue Aug 6, 2018 · 0 comments
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Aug 6, 2018

Follow up to #8059 /Cc @jorgefilipecosta

I may be wrong but seems to me the font size check is based on pixels and not points. Please notice that the WCAG requirement refers to points, not pixels. Reference:

https://www.w3.org/TR/WCAG21/#contrast-minimum

Large-scale text and images of large-scale text have a contrast ratio of at least 3:1;

"Large scale text" is defined in points, not pixels:
https://www.w3.org/TR/WCAG21/#dfn-large-scale

with at least 18 point or 14 point bold

The actual size of the character that a user sees is dependent both on the author-defined size and the user's display or user-agent settings. For many mainstream body text fonts, 14 and 18 point is roughly equivalent to 1.2 and 1.5 em or to 120% or 150% of the default size for body text (assuming that the body font is 100%), but authors would need to check this for the particular fonts in use.
etc...

So, calculating the actual point size may depend on various conditions. However, it's an (more or less) accepted practice to use 24 pixels and 18.5 pixels as values. This is explained in the WCAG "Understanding Success Criterion 1.4.3: Contrast (Minimum)":

https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html

When evaluating this success criterion, the font size in points should be obtained from the user agent or calculated on font metrics in the way that user agents do. Point sizes are based on the CSS pt size as defined in CSS3 Values. The ratio between sizes in points and CSS pixels is 1pt = 1.333px, therefore 14pt and 18pt are equivalent to approximately 18.5px and 24px.

Since it would be impossible to use a value in points, the current pixels value of 18 should be changed to 24.

@afercia afercia added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Aug 6, 2018
@jorgefilipecosta jorgefilipecosta self-assigned this Aug 23, 2018
@jorgefilipecosta jorgefilipecosta added the [Status] In Progress Tracking issues with work in progress label Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants