File tree Expand file tree Collapse file tree 6 files changed +22
-10
lines changed
test/validator/samples/a11y-autocomplete-valid Expand file tree Collapse file tree 6 files changed +22
-10
lines changed Original file line number Diff line number Diff line change 1
1
# Svelte changelog
2
2
3
+ ## 3.59.1 (Unreleased)
4
+
5
+ * Handle dynamic values in ` a11y-autocomplete-valid ` ([ #8567 ] ( https://github.com/sveltejs/svelte/pull/8567 ) )
6
+
3
7
## 3.59.0
4
8
5
9
* Add ` ResizeObserver ` bindings ` contentRect ` /` contentBoxSize ` /` borderBoxSize ` /` devicePixelContentBoxSize ` ([ #8022 ] ( https://github.com/sveltejs/svelte/pull/8022 ) )
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ export default {
164
164
} ) ,
165
165
a11y_autocomplete_valid : ( type : null | true | string , value : null | true | string ) => ( {
166
166
code : 'a11y-autocomplete-valid' ,
167
- message : `A11y: The value '${ value } ' is not supported by the attribute 'autocomplete' on element <input type="${ type } ">`
167
+ message : `A11y: The value '${ value } ' is not supported by the attribute 'autocomplete' on element <input type="${ type || '...' } ">`
168
168
} ) ,
169
169
a11y_img_redundant_alt : {
170
170
code : 'a11y-img-redundant-alt' ,
Original file line number Diff line number Diff line change @@ -857,7 +857,7 @@ export default class Element extends Node {
857
857
const type_value = type . get_static_value ( ) ;
858
858
const autocomplete_value = autocomplete . get_static_value ( ) ;
859
859
860
- if ( ! is_valid_autocomplete ( type_value , autocomplete_value ) ) {
860
+ if ( ! is_valid_autocomplete ( autocomplete_value ) ) {
861
861
component . warn ( autocomplete , compiler_warnings . a11y_autocomplete_valid ( type_value , autocomplete_value ) ) ;
862
862
}
863
863
}
Original file line number Diff line number Diff line change @@ -290,9 +290,11 @@ const autofill_contact_field_name_tokens = new Set([
290
290
'impp'
291
291
] ) ;
292
292
293
- export function is_valid_autocomplete ( type : null | true | string , autocomplete : null | true | string ) {
294
- if ( typeof autocomplete !== 'string' || typeof type !== 'string' ) {
293
+ export function is_valid_autocomplete ( autocomplete : null | true | string ) {
294
+ if ( autocomplete === true ) {
295
295
return false ;
296
+ } else if ( ! autocomplete ) {
297
+ return true ; // dynamic value
296
298
}
297
299
298
300
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