Skip to content

Conversation

@agg23
Copy link
Contributor

@agg23 agg23 commented Nov 10, 2025

Resolves #38091.

Assign columnheader and rowheader roles automatically based on the state of surrounding nodes. If all elements in a row (tr) are a header (th), these are all columnheader nodes. If all elements in the same column are a header, these are all rowheader nodes.

@agg23 agg23 requested a review from dgozman November 10, 2025 17:21
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.


Modified:
- `implicit-role.js` contains test cases extracted from `/test/commons/aria/implicit-role.js`
- `implicit-role-playwright.js` contains test cases custom to Playwright (not present in `axe-core`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just add test cases to role-utils.spec.ts instead.

{
html: '<table><thead><tr><th id="A">A</th><td>B</td></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>',
target: '#A',
role: 'cell',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one says "rowheader" in Chrome/Firefox DevTools and "columnheader" in Web Inspector.

{
html: '<table><thead><tr><th>A</th><th>B</th></thead><tbody><tr><th id="A">1</th><td>2</td></tr><tr><td>3</td><td>4</td></tr></tbody></table>',
target: '#A',
role: 'cell',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one says "rowheader" in Chrome/Firefox/Safari.

@@ -0,0 +1,32 @@
module.exports = [
{
html: '<table><thead><tr><th id="A">A</th><th>B</th></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add some tests with explicit table role=treegrid?

return 'cell';

const rows = [...table.rows];
const position = getCellPosition(table.rows, e as HTMLTableCellElement);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass rows instead?

return 'columnheader';
}

const containingColumnCells = rows.map(row => row.cells[x]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could row.cells[x] be null/undefined when colspan or rowspan is present? Let's be defensive here.

@github-actions
Copy link
Contributor

Test results for "MCP"

2640 passed, 116 skipped


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

7 failed
❌ [chromium-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @chromium-ubuntu-22.04-node18
❌ [chromium-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @chromium-ubuntu-22.04-node20
❌ [chromium-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @chromium-ubuntu-22.04-node22
❌ [chromium-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @chromium-ubuntu-22.04-node24
❌ [firefox-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @firefox-ubuntu-22.04-node18
❌ [chromium-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @ubuntu-22.04-chromium-tip-of-tree
❌ [webkit-library] › library/role-utils.spec.ts:157 › axe-core implicit-role-playwright @webkit-ubuntu-22.04-node18

4 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:397 › should work behind reverse proxy `@macos-latest-node18-2`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:659 › should indicate current test status `@macos-latest-node18-2`
⚠️ [chromium-library] › library/popup.spec.ts:258 › should not throw when click closes popup `@ubuntu-22.04-chromium-tip-of-tree`

40207 passed, 787 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: some table roles differ than those in accessibility tools

2 participants