Skip to content
Draft
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,10 @@ interface SeriesInternal {
@Component({
selector: 'si-microchart-bar',
templateUrl: './si-microchart-bar.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
role: 'img'
}
Comment on lines +32 to +34
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Adding role='img' is a good first step for accessibility, but it's incomplete. An element with an image role must have an accessible name, otherwise screen readers will announce it as an 'unlabeled image', which is not helpful.

To fix this, you should provide an accessible name via aria-label. The suggestion below adds this binding to the host. To make it work, you'll also need to add a corresponding ariaLabel input to the component class:

/**
 * Accessible label for the chart.
 * @defaultValue ''
 */
ariaLabel = input<string>('');

This will allow consumers of the component to provide a meaningful description of the chart for assistive technologies.

  host: {
    role: 'img',
    '[attr.aria-label]': 'ariaLabel()'
  }

Copy link
Copy Markdown
Member Author

@akashsonune akashsonune Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dr-itz WDYT, the role=img has to be supported by the aria-label to have a real improvement. shall we let user take care of this,i.e to provide the aria-label?

})
export class SiMicrochartBarComponent {
/** @defaultValue 64 */
Expand Down
Loading