Skip to content

Commit

Permalink
refactor(progress): replaced output by label due to a11y testing (#165)
Browse files Browse the repository at this point in the history
refactor(progress): replaced output by label due to a11y testing feedback
  • Loading branch information
mfranzke authored Nov 16, 2022
1 parent a908ba4 commit cbc3aae
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
19 changes: 16 additions & 3 deletions source/_patterns/01-elements/progress/progress.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<div class="elm-progress">
<progress {{#if value}}value="{{ value }}" {{#if maximalvalue }} max="{{ maximalvalue }}" {{/if}}{{#if conic}}
style="--progress-conic: {{ value }}" {{/if}}{{/if}} id="{{ id }}"{{#if type}} data-type="{{type}}"{{/if }}></progress>
{{#if_eq type 'loader'}}{{#if value}}<output for="{{ id }}">{{ value }}{{ unit }}</output>{{/if}}{{/if_eq}}
<progress
{{#if value}}
value="{{ value }}"
{{#if maximalvalue }} max="{{ maximalvalue }}"{{/if}}
{{#if conic}} style="--progress-conic: {{ value }}"{{/if}}
{{/if}}
id="{{ id }}"
{{#if type}} data-type="{{type}}"{{/if }}
aria-describedby="{{ id }}-label"></progress>
{{#if_eq type 'loader'}}
{{#if value}}<label
for="{{ id }}"
id="{{ id }}-label"
aria-hidden="true">{{ value }}{{ unit }}</label>
{{/if}}
{{/if_eq}}
</div>
2 changes: 1 addition & 1 deletion source/_patterns/01-elements/progress/progress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"value": "68",
"maximalvalue": "100",
"unit": "%",
"id": "progress-label-01",
"id": "progress-01",
"type": "loader"
}
3 changes: 2 additions & 1 deletion source/_patterns/01-elements/progress/progress.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
background: none;
}

& + output {
& + output, // legacy; TODO: remove with the next major release
& + label {
align-items: center;
background: $progress-conic-inner-backgroundColor; // * TODO: possibly rework variable naming
border-radius: 50%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"id": "progress-label-06",
"id": "progress-06",
"conic": true
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"id": "progress-label-04",
"id": "progress-04",
"conic": true
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"id": "progress-label-03"
"id": "progress-03"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"value": "",
"id": "progress-label-08",
"id": "progress-08",
"type": "spinner"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"value": "68",
"id": "progress-label-07",
"id": "progress-07",
"type": "spinner"
}

0 comments on commit cbc3aae

Please sign in to comment.