Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ test.describe("a11y: expander", () => {
const rulesToDisable: string[] = [
"aria-required-children",
"aria-dialog-name",
"landmark-unique",
"aria-command-name",
"nested-interactive",
];
Expand Down
2 changes: 1 addition & 1 deletion packages/bits/src/lib/expander/expander.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div
class="nui-expander__body-wrapper"
role="region"
[attr.aria-label]="header || null"
[attr.aria-label]="header || ('Expander ' + uniqueId)"
>
<div
class="nui-expander__body"
Expand Down
7 changes: 6 additions & 1 deletion packages/bits/src/lib/expander/expander.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
import { expandV2 } from "../../animations/expand";
import { KEYBOARD_CODE } from "../../constants/keycode.constants";

let nextExpanderId = 0;

/**
* <example-url>./../examples/index.html#/expander</example-url>
*/
Expand Down Expand Up @@ -84,10 +86,13 @@ export class ExpanderComponent implements AfterContentInit {

public state: "expanded" | "collapsed" = "collapsed";
public isCustomHeaderContentEmpty: boolean = false;
public uniqueId: string;

private actionKeys = [KEYBOARD_CODE.SPACE, KEYBOARD_CODE.ENTER].map(String);

constructor(private cdRef: ChangeDetectorRef) {}
constructor(private cdRef: ChangeDetectorRef) {
this.uniqueId = String(++nextExpanderId);
}

public ngAfterContentInit(): void {
this.isCustomHeaderContentEmpty =
Expand Down