diff --git a/e2e/treegrid.spec.ts b/e2e/treegrid.spec.ts index f0f39d3d..de279968 100644 --- a/e2e/treegrid.spec.ts +++ b/e2e/treegrid.spec.ts @@ -51,9 +51,13 @@ async function expectCellOrChildFocused(_page: Page, cell: Locator): Promise { - await cell.click({ position: { x: 5, y: 5 } }); + await cell.evaluate((el: HTMLElement) => el.focus()); // Check if focus is on the cell or a child element const cellIsFocused = await cell.evaluate((el) => document.activeElement === el); diff --git a/package-lock.json b/package-lock.json index a5f52250..be0c85a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "apg-patterns-examples", - "version": "0.3.7", + "version": "0.3.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "apg-patterns-examples", - "version": "0.3.7", + "version": "0.3.8", "license": "MIT", "dependencies": { "@astrojs/compiler-rs": "^0.1.10", diff --git a/package.json b/package.json index af0e0d50..bd14f73e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "apg-patterns-examples", "type": "module", - "version": "0.3.7", + "version": "0.3.8", "private": false, "description": "Accessible UI components following WAI-ARIA APG patterns. Multi-framework implementations in React, Vue, Svelte, and Astro with documentation and tests.", "author": "masuP9", diff --git a/src/content/accessibility-docs/treegrid/en.mdx b/src/content/accessibility-docs/treegrid/en.mdx index 28d928cc..adcbed8d 100644 --- a/src/content/accessibility-docs/treegrid/en.mdx +++ b/src/content/accessibility-docs/treegrid/en.mdx @@ -158,6 +158,20 @@ Total columns (for virtualization) - Tree operations (expand/collapse) only work at the rowheader column - Rows have aria-level to indicate hierarchy depth +### Mouse Support (non-APG extension) + +APG does not specify mouse behavior for the treegrid pattern. This implementation adds a minimal mouse layer that preserves the cell-only focus model and keyboard semantics defined above. + +| Action | Behavior | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| Click any cell | Move focus to the cell (updates roving tabindex). Row selection (`aria-selected`) is unchanged | +| Click a rowheader of an expandable, non-disabled row | Above, plus toggle expand/collapse | +| Click on a row with `aria-disabled="true"` | Focus may move, but expansion is not toggled (matches arrow-key behavior on disabled rows) | +| Click on an interactive descendant (`