pour-engine 1.25.0 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,6 @@
6
6
  export default {
7
7
  engine: {
8
8
  name: 'pour engine',
9
- version: '1.25.0',
9
+ version: '1.26.0',
10
10
  },
11
11
  };
@@ -1296,5 +1296,6 @@ export function rangeVerdict(foreground, range, required) {
1296
1296
  export function isLargeText(style) {
1297
1297
  const size = parseFloat(style.fontSize);
1298
1298
  const weight = parseInt(style.fontWeight, 10) || 400;
1299
- return size >= 24 || (size >= 18.66 && weight >= 700);
1299
+ // 18pt and 14pt at CSS's 96dpi: 24px, and 56/3 = 18.666…px exactly.
1300
+ return size >= 24 || (size >= 56 / 3 && weight >= 700);
1300
1301
  }
@@ -876,9 +876,25 @@ export function createContrastRule({ id, tags, help, helpUrl, thresholds }) {
876
876
  : ''))
877
877
  : '';
878
878
 
879
+ // When the colour pair already clears the LARGE-scale minimum, the miss
880
+ // is about scale, not colour: name the boundary (14pt bold / 18pt), or
881
+ // a bold-but-just-under button reads as the checker ignoring its weight.
882
+ const largeScaleNote = (() => {
883
+ if (required !== thresholds.normal || ratio < thresholds.large) return '';
884
+ const sizePx = parseFloat(style.fontSize) || 0;
885
+ const weightNum = parseInt(style.fontWeight, 10) || 400;
886
+ const shown = `${Math.round(sizePx * 10) / 10}px`;
887
+ if (weightNum >= 700 && sizePx < 56 / 3) {
888
+ return ` This text is bold at ${shown}; bold text counts as large scale from 18.67px (14pt), where the ${thresholds.large}:1 minimum would apply and these colours would pass.`;
889
+ }
890
+ if (weightNum < 700 && sizePx >= 56 / 3 && sizePx < 24) {
891
+ return ` At ${shown} regular weight this is not large scale; from 24px (18pt), or bold at this size, the ${thresholds.large}:1 minimum would apply and these colours would pass.`;
892
+ }
893
+ return '';
894
+ })();
879
895
  return {
880
896
  status: 'fail',
881
- message: `Contrast is ${showRatio(ratio)}:1 — below the ${required}:1 WCAG minimum for this text size.`,
897
+ message: `Contrast is ${showRatio(ratio)}:1 — below the ${required}:1 WCAG minimum for this text size.${largeScaleNote}`,
882
898
  fix: `Darken the text or lighten the background until the ratio reaches ${required}:1 (currently ${foregroundRgb} on ${backgroundRgb}).`
883
899
  + (authored ? ` Your CSS writes ${authored}, so searching it for the sRGB values above won't find them.` : '')
884
900
  + dimmedNote,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pour-engine",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "Accessibility (WCAG 2.2) audit engine written from the W3C specifications — runs entirely in the browser, no dependencies.",
5
5
  "type": "module",
6
6
  "main": "engine/index.js",