@cds/core
Version:
Clarity Design System - common components, themes, and utilties
58 lines (57 loc) • 2.23 kB
TypeScript
import { ReactiveController, ReactiveElement } from 'lit';
export interface AriaGrid {
grid: HTMLElement;
columnRowGroup: HTMLElement;
columnRow: HTMLElement;
columns: NodeListOf<HTMLElement>;
rowGroup: HTMLElement;
rows: NodeListOf<HTMLElement>;
cells: NodeListOf<HTMLElement>;
footerRowGroup?: HTMLElement;
footerRow?: HTMLElement;
footerCells?: NodeListOf<HTMLElement>;
placeholderCell?: HTMLElement;
}
export declare type AriaGridConfig = {
update: 'mutation' | 'slot';
};
/**
* Provides all nessesary role/aria-* attributes to create a vaild aria grid
* https://www.w3.org/TR/wai-aria-practices/examples/grid/dataGrids.html
*/
export declare function ariaGrid<T extends ReactiveElement & AriaGrid>(config?: AriaGridConfig): ClassDecorator;
export declare class AriaGridController<T extends ReactiveElement & AriaGrid> implements ReactiveController {
private host;
private config;
private observers;
private grid;
constructor(host: T, config?: AriaGridConfig);
hostConnected(): Promise<void>;
hostDisconnected(): void;
update(): void;
private intializeColumnSort;
private initializeGrid;
private intializeColumns;
private initializeRows;
/**
* If cell has focusable items NVDA will go into forms mode (expected behavior)
* Use table navigation ctrl+alt+arrow to move in and out of cells
* https://github.com/nvaccess/nvda/issues/7718
*/
private initializeCells;
private initializePlaceholder;
private intializeFooter;
/**
* Only visible columnheader text should be read to SRs but Safari/VO and NVDA violates the spec
* and deep merges any labeled content within the header even if hidden or interactive.
* This will apply a patch to force Safari and NVDA to read only the provided aria-label
*
* https://github.com/nvaccess/nvda/issues/10096
* https://github.com/nvaccess/nvda/issues/9017
* https://github.com/nvaccess/nvda/pull/12763
* https://github.com/nvaccess/nvda/issues/12392
* https://github.com/nvaccess/nvda/issues/6826
* https://github.com/nvaccess/nvda/issues/11181
*/
private patchInvalidScreenReaderBehavior;
}