Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(consumption): Added ariaLabelProgress to the consumption.
Browse files Browse the repository at this point in the history
In order to fulfil accessibility requirements, the progress-bar inside the consumption needs the ability to pass an aria-label to it.
  • Loading branch information
tomheller committed Dec 10, 2020
1 parent 6d954fd commit 5a10dc0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 43 deletions.
1 change: 1 addition & 0 deletions libs/barista-components/consumption/src/consumption.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
[max]="max"
[color]="color"
class="dt-consumption-progress-bar"
[attr.aria-label]="ariaLabelProgress"
></dt-progress-bar>

<ng-content
Expand Down
7 changes: 6 additions & 1 deletion libs/barista-components/consumption/src/consumption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ const KEY_RETURN = 13;
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.Emulated,
})
export class DtConsumption extends _DtConsumption
export class DtConsumption
extends _DtConsumption
implements AfterViewInit, OnDestroy {
/** Largest possible {@link value} for this consumption component instance. */
@Input()
Expand Down Expand Up @@ -130,6 +131,10 @@ export class DtConsumption extends _DtConsumption
}
}

/** Defines the aria-label on the progress element. */
@Input()
ariaLabelProgress: string;

/** @internal Tab index */
_tabIndex = -1;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<dt-consumption [max]="max" [value]="value">
<dt-consumption
[max]="max"
[value]="value"
ariaLabelProgress="Host unit consumption"
>
<dt-consumption-icon aria-label="Host">
<dt-icon name="host"></dt-icon>
</dt-consumption-icon>
<dt-consumption-title>
Host units
</dt-consumption-title>
<dt-consumption-title> Host units </dt-consumption-title>

<dt-consumption-count>
{{ value | dtCount }}/{{ max | dtCount }}
</dt-consumption-count>

<dt-consumption-label>
Restricted host unit hours
</dt-consumption-label>
<dt-consumption-label> Restricted host unit hours </dt-consumption-label>

<dt-consumption-overlay>
<dt-consumption [max]="max" [value]="value" class="overlay-value-panel">
<dt-consumption-title>
Host units
</dt-consumption-title>
<dt-consumption-subtitle>
Quota
</dt-consumption-subtitle>
<dt-consumption-title> Host units </dt-consumption-title>
<dt-consumption-subtitle> Quota </dt-consumption-subtitle>
<dt-consumption-count>
{{ value | dtCount }}/{{ max | dtCount }}
</dt-consumption-count>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
<dt-consumption [max]="max" [value]="value" color="error">
<dt-consumption
[max]="max"
[value]="value"
color="error"
ariaLabelProgress="Log analytics storage progress"
>
<dt-consumption-icon aria-label="Log file">
<dt-icon name="logfile"></dt-icon>
</dt-consumption-icon>
<dt-consumption-title>
Log analytics
</dt-consumption-title>
<dt-consumption-title> Log analytics </dt-consumption-title>

<dt-consumption-count>
{{ value | dtMegabytes }}/{{ max | dtMegabytes }}
</dt-consumption-count>

<dt-consumption-label>
Restricted overages
</dt-consumption-label>
<dt-consumption-label> Restricted overages </dt-consumption-label>

<dt-consumption-overlay>
<dt-consumption [max]="max" [value]="value" color="error">
<dt-consumption-title>
Log analytics
</dt-consumption-title>
<dt-consumption-subtitle>
Quota
</dt-consumption-subtitle>
<dt-consumption-title> Log analytics </dt-consumption-title>
<dt-consumption-subtitle> Quota </dt-consumption-subtitle>
<dt-consumption-count>
{{ value | dtMegabytes }}/{{ max | dtMegabytes }}
</dt-consumption-count>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<dt-consumption [max]="max" [value]="value" color="warning">
<dt-consumption
[max]="max"
[value]="value"
color="warning"
ariaLabelProgress="DEM unit consumption progress"
>
<dt-consumption-icon aria-label="User Group">
<dt-icon name="usergroup"></dt-icon>
</dt-consumption-icon>
<dt-consumption-title>
DEM units
</dt-consumption-title>
<dt-consumption-title> DEM units </dt-consumption-title>

<dt-consumption-count>
{{ value | dtCount }}/{{ max | dtCount }}
</dt-consumption-count>

<dt-consumption-label>
Flexible overages
</dt-consumption-label>
<dt-consumption-label> Flexible overages </dt-consumption-label>

<dt-consumption-overlay>
<dt-consumption
Expand All @@ -21,12 +22,8 @@
color="warning"
class="overlay-value-panel"
>
<dt-consumption-title>
DEM units
</dt-consumption-title>
<dt-consumption-subtitle>
Quota
</dt-consumption-subtitle>
<dt-consumption-title> DEM units </dt-consumption-title>
<dt-consumption-subtitle> Quota </dt-consumption-subtitle>
<dt-consumption-count>
{{ quota | dtCount }}/{{ quota | dtCount }}
</dt-consumption-count>
Expand All @@ -38,9 +35,7 @@
color="warning"
class="overlay-value-panel"
>
<dt-consumption-subtitle>
Flexible overages
</dt-consumption-subtitle>
<dt-consumption-subtitle> Flexible overages </dt-consumption-subtitle>
<dt-consumption-count>
{{ flexibleOverages | dtCount }}/unlimited
</dt-consumption-count>
Expand Down

0 comments on commit 5a10dc0

Please sign in to comment.