simple-table-core 3.6.9 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/src/utils/ariaRowOwnership.d.ts +37 -0
- package/dist/cjs/src/utils/bodyCell/types.d.ts +6 -0
- package/dist/cjs/src/utils/collapseUtils.d.ts +7 -0
- package/dist/cjs/stories/tests/45-AriaSemanticsTests.stories.d.ts +83 -0
- package/dist/index.es.js +1 -1
- package/dist/src/utils/ariaRowOwnership.d.ts +37 -0
- package/dist/src/utils/bodyCell/types.d.ts +6 -0
- package/dist/src/utils/collapseUtils.d.ts +7 -0
- package/dist/stories/tests/45-AriaSemanticsTests.stories.d.ts +83 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARIA row layer.
|
|
3
|
+
*
|
|
4
|
+
* The table renders cells as absolutely-positioned, virtualized, FLIP-animated
|
|
5
|
+
* elements. The ARIA `grid` pattern, however, requires the hierarchy
|
|
6
|
+
* `grid → rowgroup → row → gridcell/columnheader`; a flat list of cells under
|
|
7
|
+
* the section (rowgroup) makes validators (axe) report the cells as disallowed
|
|
8
|
+
* children of the rowgroup and as missing their required `row` parent.
|
|
9
|
+
*
|
|
10
|
+
* `aria-owns` does NOT solve this: axe (and the ARIA tree) still treat a cell
|
|
11
|
+
* as a child of its DOM parent, so the cell remains an invalid rowgroup child.
|
|
12
|
+
* The cells must therefore be real DOM descendants of a `role="row"` element.
|
|
13
|
+
*
|
|
14
|
+
* To get that hierarchy without disturbing the carefully-tuned positioning and
|
|
15
|
+
* animation machinery, the row element uses `display: contents`: it generates
|
|
16
|
+
* no box, establishes no containing block, and takes part in no layout, so its
|
|
17
|
+
* absolutely-positioned cell children are laid out exactly as if they were
|
|
18
|
+
* still direct children of the section. It is still present in the
|
|
19
|
+
* accessibility tree (axe's screen-reader visibility check only looks at
|
|
20
|
+
* `display:none` / `visibility` / `content-visibility` / `aria-hidden`, never
|
|
21
|
+
* at box size), so it provides the required `row` layer for free.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Return the `role="row"` element for `rowKey` inside `container`, creating it
|
|
25
|
+
* (as a zero-box `display: contents` element) on first use. Refreshes
|
|
26
|
+
* `aria-rowindex` when it changes. New cells should be appended to the returned
|
|
27
|
+
* element so they become DOM descendants of a row.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getOrCreateRowElement: (container: HTMLElement, rowKey: string, ariaRowIndex: number) => HTMLElement;
|
|
30
|
+
/**
|
|
31
|
+
* Remove row elements that no longer contain any cells. Retained animation
|
|
32
|
+
* "ghost" cells keep their row alive until they finish and remove themselves,
|
|
33
|
+
* so we prune purely on emptiness rather than on a live-row set.
|
|
34
|
+
*/
|
|
35
|
+
export declare const reconcileRowElements: (container: HTMLElement) => void;
|
|
36
|
+
/** Remove every row element tracked for `container`. */
|
|
37
|
+
export declare const cleanupAriaRows: (container: HTMLElement) => void;
|
|
@@ -71,6 +71,12 @@ export interface CellRenderContext {
|
|
|
71
71
|
useOddEvenRowBackground?: boolean;
|
|
72
72
|
rowGrouping?: string[];
|
|
73
73
|
headers: HeaderObject[];
|
|
74
|
+
/**
|
|
75
|
+
* Accessor of the column whose body cells identify the row and should carry
|
|
76
|
+
* `role="rowheader"` (the first non-selection leaf column). Other data cells
|
|
77
|
+
* remain `role="gridcell"`.
|
|
78
|
+
*/
|
|
79
|
+
rowHeaderAccessor?: Accessor;
|
|
74
80
|
rowHeight: number;
|
|
75
81
|
/** Number of header rows (for aria-rowindex: position + maxHeaderDepth + 1) */
|
|
76
82
|
maxHeaderDepth?: number;
|
|
@@ -17,6 +17,13 @@ export declare const getAllChildHeaders: (header: HeaderObject) => HeaderObject[
|
|
|
17
17
|
* Check if a header has collapsible children
|
|
18
18
|
*/
|
|
19
19
|
export declare const hasCollapsibleChildren: (header: HeaderObject) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Number of visible leaf (bottom-level) columns a header spans, for
|
|
22
|
+
* `aria-colspan` on grouped/nested header cells. Leaf headers that are hidden
|
|
23
|
+
* (`hide`) or suppressed by their parent's collapsed state are excluded so the
|
|
24
|
+
* announced span matches the columns actually rendered. Leaf headers return 1.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getHeaderColspan: (header: HeaderObject, rootHeaders: HeaderObject[], collapsedHeaders: Set<Accessor>) => number;
|
|
20
27
|
/**
|
|
21
28
|
* Get all leaf (bottom-level) headers that should be visible when a parent is collapsed
|
|
22
29
|
* Uses flattenHeaders for consistent leaf detection
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARIA SEMANTICS TESTS
|
|
3
|
+
*
|
|
4
|
+
* These tests assert the ARIA state/relationship semantics that a non-native
|
|
5
|
+
* (role="grid") table must apply by hand: selection state, expansion/treegrid
|
|
6
|
+
* levels, grouped-header span, row headers, nested/state rows in the hierarchy,
|
|
7
|
+
* header rowspan, and collapsible column-header expansion.
|
|
8
|
+
*/
|
|
9
|
+
import type { Meta } from "@storybook/html";
|
|
10
|
+
declare const meta: Meta;
|
|
11
|
+
export default meta;
|
|
12
|
+
export declare const SelectedRowsExposeAriaSelected: {
|
|
13
|
+
render: () => HTMLDivElement & {
|
|
14
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
15
|
+
};
|
|
16
|
+
play: ({ canvasElement }: {
|
|
17
|
+
canvasElement: HTMLElement;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
export declare const GridExposesAriaMultiselectable: {
|
|
21
|
+
render: () => HTMLDivElement & {
|
|
22
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
23
|
+
};
|
|
24
|
+
play: ({ canvasElement }: {
|
|
25
|
+
canvasElement: HTMLElement;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
export declare const ExpandableRowsExposeAriaExpandedOnRow: {
|
|
29
|
+
render: () => HTMLDivElement & {
|
|
30
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
31
|
+
};
|
|
32
|
+
play: ({ canvasElement }: {
|
|
33
|
+
canvasElement: HTMLElement;
|
|
34
|
+
}) => Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
export declare const ExpandableGridExposesTreegridLevels: {
|
|
37
|
+
render: () => HTMLDivElement & {
|
|
38
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
39
|
+
};
|
|
40
|
+
play: ({ canvasElement }: {
|
|
41
|
+
canvasElement: HTMLElement;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
export declare const GroupedHeadersExposeAriaColspan: {
|
|
45
|
+
render: () => HTMLDivElement & {
|
|
46
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
47
|
+
};
|
|
48
|
+
play: ({ canvasElement }: {
|
|
49
|
+
canvasElement: HTMLElement;
|
|
50
|
+
}) => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
export declare const IdentityColumnExposesRowHeader: {
|
|
53
|
+
render: () => HTMLDivElement & {
|
|
54
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
55
|
+
};
|
|
56
|
+
play: ({ canvasElement }: {
|
|
57
|
+
canvasElement: HTMLElement;
|
|
58
|
+
}) => Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
export declare const NestedTableRowsAreInRowHierarchy: {
|
|
61
|
+
render: () => HTMLDivElement & {
|
|
62
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
63
|
+
};
|
|
64
|
+
play: ({ canvasElement }: {
|
|
65
|
+
canvasElement: HTMLElement;
|
|
66
|
+
}) => Promise<void>;
|
|
67
|
+
};
|
|
68
|
+
export declare const LeafHeadersExposeRowSpan: {
|
|
69
|
+
render: () => HTMLDivElement & {
|
|
70
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
71
|
+
};
|
|
72
|
+
play: ({ canvasElement }: {
|
|
73
|
+
canvasElement: HTMLElement;
|
|
74
|
+
}) => Promise<void>;
|
|
75
|
+
};
|
|
76
|
+
export declare const CollapsibleColumnHeaderExposesAriaExpanded: {
|
|
77
|
+
render: () => HTMLDivElement & {
|
|
78
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
79
|
+
};
|
|
80
|
+
play: ({ canvasElement }: {
|
|
81
|
+
canvasElement: HTMLElement;
|
|
82
|
+
}) => Promise<void>;
|
|
83
|
+
};
|