Skip to content

Commit

Permalink
feat(a11y): Accessibility improvements for Dialog, Drawer, Progress I…
Browse files Browse the repository at this point in the history
…ndicator and Radio
  • Loading branch information
mryunt02 committed Oct 18, 2024
1 parent 3a22ca0 commit df749a4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/dialog/bl-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export default class BlDialog extends LitElement {
? html`<bl-button
@click="${() => this.closeDialog("close-button")}"
icon="close"
label="close"
variant="tertiary"
kind="neutral"
size="small"
Expand Down
1 change: 1 addition & 0 deletions src/components/drawer/bl-drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default class BlDrawer extends LitElement {
<bl-button
@click="${this.closeDrawer}"
icon="close"
label="close"
size="small"
variant="tertiary"
kind="neutral"
Expand Down
1 change: 1 addition & 0 deletions src/components/progress-indicator/bl-progress-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default class BlProgressIndicator extends LitElement {
return html`<div
class="progress-indicator"
role="progressbar"
aria-label="progress indicator"
aria-valuemax="${this._max}"
aria-valuenow="${this._value}"
></div>`;
Expand Down
10 changes: 10 additions & 0 deletions src/components/radio-group/radio/bl-radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export default class BlRadio extends LitElement {
this.selected = newValue === this.value;
};

private handleKeyDown = (event: KeyboardEvent) => {
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
this.select();
}
};

private field: BlRadioGroup | null;

connectedCallback(): void {
Expand Down Expand Up @@ -119,11 +126,14 @@ export default class BlRadio extends LitElement {
return html`<div
class=${classes}
role="radio"
tabindex="1"
aria-labelledby="label"
aria-disabled=${this.disabled}
aria-readonly=${this.disabled}
aria-checked=${this.selected}
@blur=${this.blur}
@click=${this.select}
@keydown=${this.handleKeyDown}
>
<p id="label"><slot></slot></p>
</div>`;
Expand Down

0 comments on commit df749a4

Please sign in to comment.