diff --git a/tests/holdem/uiAudit.js b/tests/holdem/uiAudit.js index 98b270d..0c1bca8 100644 --- a/tests/holdem/uiAudit.js +++ b/tests/holdem/uiAudit.js @@ -368,8 +368,18 @@ const LayoutAudit = { : [...document.querySelectorAll("*")]; nodes.forEach(el => { - if (el.children.length > 0) return; // leaf text only - const text = (el.textContent || "").trim(); + // An element's *own* text, not its descendants' — they get measured on + // their own turn, against their own colour. + // + // This used to be "leaf elements only", which quietly stopped measuring + // anything the moment a child was added to it. The undo control went that + // way the day a was appended to it: its label became invisible to + // this check, with no sign that anything had changed. + const text = [...el.childNodes] + .filter(node => node.nodeType === 3) + .map(node => node.textContent) + .join(" ") + .trim(); if (!text) return; const rect = el.getBoundingClientRect(); if (rect.width === 0 || rect.height === 0) return; @@ -390,11 +400,18 @@ const LayoutAudit = { unmeasured.push(`${this.describe(el)} :: faded (opacity ${opacity}), contrast not checked`); return; } - // Decoration is exempt by definition: the watermark on the felt is meant - // to be barely there, and holding it to a reading threshold would mean - // making it not a watermark. Marked aria-hidden so screen readers skip it - // too, which is the same claim expressed where it also does some good. - if (el.closest("[aria-hidden='true']")) return; + // aria-hidden used to exempt text here, on the grounds that decoration + // marked for screen readers was decoration for everyone. Those are two + // different questions and the answer differs: the bet chips on the felt are + // aria-hidden because their amounts are already announced by the seat and + // the action bar, and repeating them would be noise — but they are exactly + // what a sighted dealer reads the felt for, and this check had stopped + // looking at them. Hiding something from one audience is not a claim about + // whether the other audience can read it. + // + // Nothing is exempt now. If something genuinely decorative turns up, it + // should say so in its own words rather than borrowing an attribute that + // means something else. const fgRaw = this.parseColour(style.color); if (!fgRaw) return;