commit bb4064b38a490906b38cb46acbb9494bb9ff90f4
parent fe809e674441c6b7cd9b12030fec7f442e877ddf
Author: finwo <finwo@pm.me>
Date: Mon, 30 Nov 2026 21:07:41 +0100
tools: align gate skips hidden rows
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/css-check/align.mjs b/tools/css-check/align.mjs
@@ -1,5 +1,6 @@
#!/usr/bin/env node
// Table alignment gate: zero-size inline-block baseline probes, zero spread.
+// Rows whose computed display is none (pager/search-hidden) are skipped.
//
// node tools/css-check/align.mjs
// node tools/css-check/align.mjs --fixture tools/css-check/fixtures/negative-misaligned.html
@@ -142,7 +143,7 @@ function measurementExpression(theme) {
function q(v) { return Math.round(v * Q); }
var out = {
- tables: 0, rows: 0, multiCells: 0, allTallRows: 0, mode: 'none',
+ tables: 0, rows: 0, hiddenRows: 0, multiCells: 0, allTallRows: 0, mode: 'none',
maxSpreadGrid: 0, captions: 0, fail: []
};
@@ -210,6 +211,10 @@ function measurementExpression(theme) {
out.fail.push(at + ': thead is not rendered in table mode');
}
for (var r = 0; r < rows.length; r += 1) {
+ if (window.getComputedStyle(rows[r]).display === 'none') {
+ out.hiddenRows += 1;
+ continue;
+ }
var cells = rows[r].querySelectorAll('td');
var baselines = [];
var filledCells = 0;
@@ -266,6 +271,10 @@ function measurementExpression(theme) {
out.fail.push(at + ': thead is visible in card mode');
}
for (var r2 = 0; r2 < rows.length; r2 += 1) {
+ if (window.getComputedStyle(rows[r2]).display === 'none') {
+ out.hiddenRows += 1;
+ continue;
+ }
var cells2 = rows[r2].querySelectorAll('td');
if (!cells2.length) {
out.fail.push(at + ' row ' + (r2 + 1) + ': no cells to stack');
@@ -380,8 +389,8 @@ async function main() {
const head = `${target.label} ${String(width).padStart(4)} ${theme.padEnd(4)}`;
const stats =
m.mode === 'table'
- ? `mode=table tables=${m.tables} rows=${m.rows} multi-cells=${m.multiCells} all-tall-rows=${m.allTallRows} max-baseline-spread=${m.maxSpreadGrid}/64`
- : `mode=card tables=${m.tables} rows=${m.rows} captions=${m.captions}`;
+ ? `mode=table tables=${m.tables} rows=${m.rows} hidden=${m.hiddenRows} multi-cells=${m.multiCells} all-tall-rows=${m.allTallRows} max-baseline-spread=${m.maxSpreadGrid}/64`
+ : `mode=card tables=${m.tables} rows=${m.rows} hidden=${m.hiddenRows} captions=${m.captions}`;
if (target.negative && m.mode === 'table') {
if (gateRed) {