openvibers/openvibe.codes Commits
Codes: tables that scroll are focusable, named regions (#78)
Changes
@@@ -27,7 +27,8 @@ const time = (iso) => (iso ? html`<time datetime="${iso}">${String(iso).replace(/** A <table> from headers and rows of cells (cells are already html or plain values). */function table(headers, rows, { cls = '', empty = 'Nothing here yet.' } = {}) {if (!rows.length) return html`<p class="muted">${empty}</p>`;-- return html`<div class="table-wrap"><table class="${cls}"><thead><tr>${headers.map((h) => html`<th scope="col">${h}</th>`)}</tr></thead><tbody>${rows.map((r) => html`<tr>${r.map((c) => html`<td>${c}</td>`)}</tr>`)}</tbody></table></div>`;++ // The wrapper scrolls sideways on a phone, so it is a focusable, named region (axe scrollable-region-focusable).++ return html`<div class="table-wrap" tabindex="0" role="region" aria-label="Table: ${headers.join(', ')}"><table class="${cls}"><thead><tr>${headers.map((h) => html`<th scope="col">${h}</th>`)}</tr></thead><tbody>${rows.map((r) => html`<tr>${r.map((c) => html`<td>${c}</td>`)}</tr>`)}</tbody></table></div>`;}/** A problem as returned by Network, Events or Media — shown as it came, never softened. */@@@ -57,6 +57,8 @@ const BOOST = /<script src="\/shared\/boost\.js\?v=[0-9a-f]{12}" data-main="#maiawait check('the navbar config uses the {path} login template, not the path baked in', async () => {const r = await t.get('/harnesses');assert.match(r.text, /"loginUrl":"\/auth\/login\?next=\{path\}"/);++ // A table scrolls sideways on a phone: its wrapper is a focusable, named region (axe scrollable-region-focusable).++ assert.ok(r.text.includes('<div class="table-wrap" tabindex="0" role="region" aria-label="Table: '), 'focusable table region');assert.ok(!/"loginUrl":"\/auth\/login\?next=%2F/.test(r.text), 'loginUrl still has the current path baked in');});
@@ -27,7 +27,8 @@ const time = (iso) => (iso ? html`<time datetime="${iso}">${String(iso).replace(
@@ -27,7 +27,8 @@ const time = (iso) => (iso ? html`<time datetime="${iso}">${String(iso).replace(
/** A <table> from headers and rows of cells (cells are already html or plain values). */
/** A <table> from headers and rows of cells (cells are already html or plain values). */
function table(headers, rows, { cls = '', empty = 'Nothing here yet.' } = {}) {
function table(headers, rows, { cls = '', empty = 'Nothing here yet.' } = {}) {
if (!rows.length) return html`<p class="muted">${empty}</p>`;
if (!rows.length) return html`<p class="muted">${empty}</p>`;
- return html`<div class="table-wrap"><table class="${cls}"><thead><tr>${headers.map((h) => html`<th scope="col">${h}</th>`)}</tr></thead><tbody>${rows.map((r) => html`<tr>${r.map((c) => html`<td>${c}</td>`)}</tr>`)}</tbody></table></div>`;
+ // The wrapper scrolls sideways on a phone, so it is a focusable, named region (axe scrollable-region-focusable).
+ return html`<div class="table-wrap" tabindex="0" role="region" aria-label="Table: ${headers.join(', ')}"><table class="${cls}"><thead><tr>${headers.map((h) => html`<th scope="col">${h}</th>`)}</tr></thead><tbody>${rows.map((r) => html`<tr>${r.map((c) => html`<td>${c}</td>`)}</tr>`)}</tbody></table></div>`;
}
}
/** A problem as returned by Network, Events or Media — shown as it came, never softened. */
/** A problem as returned by Network, Events or Media — shown as it came, never softened. */
@@ -57,6 +57,8 @@ const BOOST = /<script src="\/shared\/boost\.js\?v=[0-9a-f]{12}" data-main="#mai
@@ -57,6 +57,8 @@ const BOOST = /<script src="\/shared\/boost\.js\?v=[0-9a-f]{12}" data-main="#mai
await check('the navbar config uses the {path} login template, not the path baked in', async () => {
await check('the navbar config uses the {path} login template, not the path baked in', async () => {
const r = await t.get('/harnesses');
const r = await t.get('/harnesses');
assert.match(r.text, /"loginUrl":"\/auth\/login\?next=\{path\}"/);
assert.match(r.text, /"loginUrl":"\/auth\/login\?next=\{path\}"/);
+ // A table scrolls sideways on a phone: its wrapper is a focusable, named region (axe scrollable-region-focusable).
+ assert.ok(r.text.includes('<div class="table-wrap" tabindex="0" role="region" aria-label="Table: '), 'focusable table region');
assert.ok(!/"loginUrl":"\/auth\/login\?next=%2F/.test(r.text), 'loginUrl still has the current path baked in');
assert.ok(!/"loginUrl":"\/auth\/login\?next=%2F/.test(r.text), 'loginUrl still has the current path baked in');
});
});