Commit 41087e0
committed
fix(template-no-invalid-role): flag empty / whitespace-only role attribute
Previously the rule early-returned when the trimmed role value was empty,
silently accepting `<div role="">` and `<div role=" ">`. Both jsx-a11y
and vue-a11y flag these — they're authoring mistakes, not no-ops, since
the attribute is malformed (no recognized role token) and supplies zero
ARIA semantics while still appearing in the DOM.
Replace the early-return with a single 'invalid' report (role rendered
as the empty string in the message), keeping the existing error format
intact. No new messageId; the existing 'invalid' template renders the
empty value clearly.
Tests: move `role=""` from valid to invalid; add `role=" "` for
parity with the trim-then-flag path. Documented as ports of the audit-
fixture divergence cases that previously pinned the under-flag behavior.1 parent 5919767 commit 41087e0
2 files changed
Lines changed: 25 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
160 | 169 | | |
161 | 170 | | |
162 | 171 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
168 | 175 | | |
169 | 176 | | |
170 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 97 | | |
103 | 98 | | |
104 | 99 | | |
| |||
110 | 105 | | |
111 | 106 | | |
112 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
| |||
0 commit comments