Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/fix-table-accessibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@patternfly/elements": patch
---
`<pf-table>`: fix accessibility features: column header role, accessible label for row toggle button, etc.
2 changes: 1 addition & 1 deletion elements/pf-table/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { createContextWithRoot } from '@patternfly/pfe-core/functions/context.js

export const thRoleContext: {
__context__: unknown;
} = createContextWithRoot<'rowheader' | 'colheader'>('pf-th-role');
} = createContextWithRoot<'rowheader' | 'columnheader'>('pf-th-role');
2 changes: 1 addition & 1 deletion elements/pf-table/pf-th.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class PfTh extends LitElement {
@property() key!: string;

@consume({ context: thRoleContext })
private contextualRole: 'colheader' | 'rowheader' = 'rowheader';
private contextualRole: 'columnheader' | 'rowheader' = 'rowheader';

override connectedCallback(): void {
super.connectedCallback();
Expand Down
2 changes: 1 addition & 1 deletion elements/pf-table/pf-thead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { provide } from '@lit/context';
export class PfThead extends LitElement {
static readonly styles: CSSStyleSheet[] = [styles];

@provide({ context: thRoleContext }) private thRowContext = 'colheader';
@provide({ context: thRoleContext }) private thRowContext = 'columnheader';

connectedCallback(): void {
super.connectedCallback();
Expand Down
2 changes: 2 additions & 0 deletions elements/pf-table/pf-tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export class PfTr extends LitElement {
<pf-td id="toggle-cell">
<pf-button id="toggle-button"
aria-expanded=${String(this.expanded) as 'true' | 'false'}
aria-controls=${ifDefined(this.expanded ? 'expansion' : undefined)}
plain
label="Details"
@click=${this.#onClick}>
<pf-icon id="toggle-icon"
icon="angle-right"
Expand Down
Loading