@aiaiai-pt/design-system 0.31.1 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,27 +61,32 @@
|
|
|
61
61
|
data-testid="text-size-adjuster"
|
|
62
62
|
{...rest}
|
|
63
63
|
>
|
|
64
|
+
<!--
|
|
65
|
+
WCAG 2.5.3 (Label in Name): the accessible name MUST contain the visible
|
|
66
|
+
text. The visible label is the glyph ("A−" / "A" / "A+"), so the
|
|
67
|
+
glyph is part of the name (NOT aria-hidden, NOT replaced by aria-label) and
|
|
68
|
+
the descriptive i18n label rides along as visually-hidden text. Result, e.g.
|
|
69
|
+
name = "A− Decrease text size", whose visible substring "A−"
|
|
70
|
+
satisfies the rule while screen readers still hear the full description.
|
|
71
|
+
-->
|
|
64
72
|
<button
|
|
65
73
|
type="button"
|
|
66
74
|
class="ts-btn ts-decrease"
|
|
67
|
-
aria-label={decreaseLabel}
|
|
68
75
|
disabled={atMin}
|
|
69
76
|
onclick={() => emit(decreaseTextSize(current))}
|
|
70
|
-
>A
|
|
77
|
+
>A−<span class="sr-only"> {decreaseLabel}</span></button>
|
|
71
78
|
<button
|
|
72
79
|
type="button"
|
|
73
80
|
class="ts-btn ts-reset"
|
|
74
|
-
aria-label={resetLabel}
|
|
75
81
|
disabled={atDefault}
|
|
76
82
|
onclick={() => emit(DEFAULT_TEXT_SIZE)}
|
|
77
|
-
>A</button>
|
|
83
|
+
>A<span class="sr-only"> {resetLabel}</span></button>
|
|
78
84
|
<button
|
|
79
85
|
type="button"
|
|
80
86
|
class="ts-btn ts-increase"
|
|
81
|
-
aria-label={increaseLabel}
|
|
82
87
|
disabled={atMax}
|
|
83
88
|
onclick={() => emit(increaseTextSize(current))}
|
|
84
|
-
>A
|
|
89
|
+
>A+<span class="sr-only"> {increaseLabel}</span></button>
|
|
85
90
|
<span class="sr-only" aria-live="polite" data-testid="text-size-readout"
|
|
86
91
|
>{current}%</span
|
|
87
92
|
>
|
package/components/Toggle.svelte
CHANGED
|
@@ -10,10 +10,6 @@
|
|
|
10
10
|
@example Disabled
|
|
11
11
|
<Toggle label="Notifications" checked disabled />
|
|
12
12
|
-->
|
|
13
|
-
<script module>
|
|
14
|
-
let _toggleUid = 0;
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
13
|
<script>
|
|
18
14
|
let {
|
|
19
15
|
/** @type {boolean} */
|
|
@@ -31,9 +27,11 @@
|
|
|
31
27
|
...rest
|
|
32
28
|
} = $props();
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
// No auto-generated id: the switch self-names via aria-label, so it needs no
|
|
31
|
+
// id/labelledby plumbing. A module-counter fallback id (`toggle-N`) diverged
|
|
32
|
+
// between SSR and client (server counter ≠ fresh client counter), an id that
|
|
33
|
+
// could surface as a duplicate/parse error; an id is now emitted ONLY when a
|
|
34
|
+
// consumer passes one.
|
|
37
35
|
function handleClick() {
|
|
38
36
|
if (!disabled) {
|
|
39
37
|
checked = !checked;
|
|
@@ -50,7 +48,7 @@
|
|
|
50
48
|
override (e.g. type="submit" if they really want submit semantics).
|
|
51
49
|
-->
|
|
52
50
|
<button
|
|
53
|
-
id
|
|
51
|
+
{id}
|
|
54
52
|
class="toggle"
|
|
55
53
|
class:toggle-on={checked}
|
|
56
54
|
class:toggle-disabled={disabled}
|
|
@@ -58,15 +56,23 @@
|
|
|
58
56
|
type="button"
|
|
59
57
|
role="switch"
|
|
60
58
|
aria-checked={checked}
|
|
61
|
-
aria-
|
|
59
|
+
aria-label={label}
|
|
62
60
|
{...rest}
|
|
63
61
|
onclick={handleClick}
|
|
64
62
|
>
|
|
65
63
|
<span class="toggle-knob"></span>
|
|
66
64
|
</button>
|
|
67
65
|
{#if label}
|
|
66
|
+
<!--
|
|
67
|
+
The switch now names itself directly via aria-label (was aria-labelledby →
|
|
68
|
+
this span). Stricter ACT accessible-name engines (QualWeb/AccessMonitor)
|
|
69
|
+
did not credit a name referenced through a role="none" target and read the
|
|
70
|
+
switch as nameless; a direct aria-label is unambiguous. This span is the
|
|
71
|
+
VISIBLE label only — role="none" keeps it out of the a11y tree so the name
|
|
72
|
+
isn't announced twice. Click still toggles (sighted affordance); the button
|
|
73
|
+
stays the keyboard/AT target.
|
|
74
|
+
-->
|
|
68
75
|
<span
|
|
69
|
-
id="{toggleId}-label"
|
|
70
76
|
class="toggle-label"
|
|
71
77
|
class:toggle-label-disabled={disabled}
|
|
72
78
|
onclick={handleClick}
|