File tree Expand file tree Collapse file tree 6 files changed +23
-10
lines changed
test/validator/samples/a11y-autocomplete-valid Expand file tree Collapse file tree 6 files changed +23
-10
lines changed Original file line number Diff line number Diff line change 25
25
* Fix transitions so that they don't require a ` style-src 'unsafe-inline' ` Content Security Policy (CSP) ([ #6662 ] ( https://github.com/sveltejs/svelte/issues/6662 ) ).
26
26
* Explicitly disallow ` var ` declarations extending the reactive statement scope ([ #6800 ] ( https://github.com/sveltejs/svelte/pull/6800 ) )
27
27
28
+ ## 3.59.1
29
+
30
+ * Handle dynamic values in ` a11y-autocomplete-valid ` ([ #8567 ] ( https://github.com/sveltejs/svelte/pull/8567 ) )
31
+
28
32
## 3.59.0
29
33
30
34
* Add ` ResizeObserver ` bindings ` contentRect ` /` contentBoxSize ` /` borderBoxSize ` /` devicePixelContentBoxSize ` ([ #8022 ] ( https://github.com/sveltejs/svelte/pull/8022 ) )
37
41
* Fix type of ` VERSION ` compiler export ([ #8498 ] ( https://github.com/sveltejs/svelte/issues/8498 ) )
38
42
* Relax ` a11y-no-redundant-roles ` warning ([ #8536 ] ( https://github.com/sveltejs/svelte/pull/8536 ) )
39
43
* Handle nested array rest destructuring ([ #8552 ] ( https://github.com/sveltejs/svelte/issues/8552 ) , [ #8554 ] ( https://github.com/sveltejs/svelte/issues/8554 ) )
44
+
40
45
## 3.58.0
41
46
42
47
* Add ` bind:innerText ` for ` contenteditable ` elements ([ #3311 ] ( https://github.com/sveltejs/svelte/issues/3311 ) )
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ export default {
172
172
} ) ,
173
173
a11y_autocomplete_valid : ( type : null | true | string , value : null | true | string ) => ( {
174
174
code : 'a11y-autocomplete-valid' ,
175
- message : `A11y: The value '${ value } ' is not supported by the attribute 'autocomplete' on element <input type="${ type } ">`
175
+ message : `A11y: The value '${ value } ' is not supported by the attribute 'autocomplete' on element <input type="${ type || '...' } ">`
176
176
} ) ,
177
177
a11y_img_redundant_alt : {
178
178
code : 'a11y-img-redundant-alt' ,
Original file line number Diff line number Diff line change @@ -927,7 +927,7 @@ export default class Element extends Node {
927
927
const type_value = type . get_static_value ( ) ;
928
928
const autocomplete_value = autocomplete . get_static_value ( ) ;
929
929
930
- if ( ! is_valid_autocomplete ( type_value , autocomplete_value ) ) {
930
+ if ( ! is_valid_autocomplete ( autocomplete_value ) ) {
931
931
component . warn ( autocomplete , compiler_warnings . a11y_autocomplete_valid ( type_value , autocomplete_value ) ) ;
932
932
}
933
933
}
Original file line number Diff line number Diff line change @@ -295,9 +295,11 @@ const autofill_contact_field_name_tokens = new Set([
295
295
'impp'
296
296
] ) ;
297
297
298
- export function is_valid_autocomplete ( type : null | true | string , autocomplete : null | true | string ) {
299
- if ( typeof autocomplete !== 'string' || typeof type !== 'string' ) {
298
+ export function is_valid_autocomplete ( autocomplete : null | true | string ) {
299
+ if ( autocomplete === true ) {
300
300
return false ;
301
+ } else if ( ! autocomplete ) {
302
+ return true ; // dynamic value
301
303
}
302
304
303
305
const tokens = autocomplete . trim ( ) . toLowerCase ( ) . split ( regex_whitespaces ) ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ let dynamic = ' ' ;
3
+ </script >
4
+
1
5
<!-- VALID -->
2
6
<input type =" text" />
3
7
<input type =" text" autocomplete =" name" />
14
18
<input type =" hidden" autocomplete =" off" />
15
19
<input type =" hidden" autocomplete =" on" />
16
20
<input type =" text" autocomplete =" " />
21
+ <input type =" {dynamic }" autocomplete =" " />
22
+ <input type ="text" autocomplete =" {dynamic }" />
17
23
18
24
<!-- INVALID -->
19
25
<input type =" text" autocomplete />
Original file line number Diff line number Diff line change 3
3
"code" : " a11y-autocomplete-valid" ,
4
4
"end" : {
5
5
"column" : 31 ,
6
- "line" : 19
6
+ "line" : 25
7
7
},
8
8
"message" : " A11y: The value 'true' is not supported by the attribute 'autocomplete' on element <input type=\" text\" >" ,
9
9
"start" : {
10
10
"column" : 19 ,
11
- "line" : 19
11
+ "line" : 25
12
12
}
13
13
},
14
14
{
15
15
"code" : " a11y-autocomplete-valid" ,
16
16
"end" : {
17
17
"column" : 43 ,
18
- "line" : 20
18
+ "line" : 26
19
19
},
20
20
"message" : " A11y: The value 'incorrect' is not supported by the attribute 'autocomplete' on element <input type=\" text\" >" ,
21
21
"start" : {
22
22
"column" : 19 ,
23
- "line" : 20
23
+ "line" : 26
24
24
}
25
25
},
26
26
{
27
27
"code" : " a11y-autocomplete-valid" ,
28
28
"end" : {
29
29
"column" : 42 ,
30
- "line" : 21
30
+ "line" : 27
31
31
},
32
32
"message" : " A11y: The value 'webauthn' is not supported by the attribute 'autocomplete' on element <input type=\" text\" >" ,
33
33
"start" : {
34
34
"column" : 19 ,
35
- "line" : 21
35
+ "line" : 27
36
36
}
37
37
}
38
38
]
You can’t perform that action at this time.
0 commit comments