Skip to content

Commit

Permalink
fix(ui-library): button group accessibility (#595) (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikdi authored Nov 23, 2023
1 parent 1462489 commit 1f28479
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TAG_NAME = 'blr-icon-button';
export class BlrIconButton extends LitElement {
static styles = [styleCustom];

@property() arialabel?: string;
@property() arialabel!: string;
@property() icon?: SizelessIconType;
@property() onClick?: HTMLButtonElement['onclick'];
@property() onBlur?: HTMLButtonElement['onblur'];
Expand Down Expand Up @@ -50,8 +50,8 @@ export class BlrIconButton extends LitElement {
const dynamicStyles = this.theme === 'Light' ? [actionLight] : [actionDark];

const classes = classMap({
[`${this.variant}`]: this.variant,
[`${this.size}`]: this.size,
[this.variant]: this.variant,
[this.size]: this.size,
disabled: this.disabled,
loading: this.loading || false,
});
Expand All @@ -77,10 +77,10 @@ export class BlrIconButton extends LitElement {
'Icon',
]).toLowerCase() as SizesType;

return html`<style>
${dynamicStyles.map((style) => style)}
return html`
<style>
${dynamicStyles}
</style>
<span
aria-label=${this.arialabel || nothing}
class="blr-semantic-action blr-icon-button ${classes}"
Expand All @@ -107,7 +107,8 @@ export class BlrIconButton extends LitElement {
hideAria: true,
classMap: iconClasses,
})}
</span>`;
</span>
`;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const contentIconButtons = html`
variant: 'primary',
loadingStatus: 'Loading',
disabled: false,
arialabel: 'button_1',
})}
${BlrIconButtonRenderFunction({
size: 'md',
Expand All @@ -38,6 +39,7 @@ const contentIconButtons = html`
variant: 'secondary',
loadingStatus: 'Loading',
disabled: false,
arialabel: 'button_2',
})}
`;

Expand Down

0 comments on commit 1f28479

Please sign in to comment.