mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
chore: add aria-busy and set valuenow to 0 when not active
This commit is contained in:
parent
f2a0fb03c6
commit
b890a8848c
1 changed files with 11 additions and 1 deletions
|
@ -49,7 +49,16 @@
|
|||
let helperId = "ccs-" + Math.random().toString(36);
|
||||
|
||||
$: indeterminate = value === undefined && status === "active";
|
||||
$: capped = value > max ? max : value < 0 ? 0 : value;
|
||||
let capped;
|
||||
$: {
|
||||
if (status === "error" || value < 0) {
|
||||
capped = 0;
|
||||
} else if (value > max) {
|
||||
capped = max;
|
||||
} else {
|
||||
capped = value;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
@ -82,6 +91,7 @@
|
|||
role="progressbar"
|
||||
id="{id}"
|
||||
class:bx--progress-bar__track="{true}"
|
||||
aria-busy="{status === 'active'}"
|
||||
aria-valuemin="{indeterminate ? undefined : 0}"
|
||||
aria-valuemax="{indeterminate ? undefined : max}"
|
||||
aria-valuenow="{indeterminate ? undefined : capped}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue