12
12
:id =" `${computedId}selected_tags__`"
13
13
class =" visually-hidden"
14
14
:for =" _inputId"
15
- :aria-live =" focus ? 'polite' : 'off'"
15
+ :aria-live =" focused ? 'polite' : 'off'"
16
16
aria-atomic =" true"
17
17
aria-relevant =" additions text"
18
18
>{{ tags.join(', ') }}</output
19
19
>
20
20
<div
21
21
:id =" `${computedId}removed_tags__`"
22
22
role =" status"
23
- :aria-live =" focus ? 'assertive' : 'off'"
23
+ :aria-live =" focused ? 'assertive' : 'off'"
24
24
aria-atomic =" true"
25
25
class =" visually-hidden"
26
26
>
@@ -247,7 +247,6 @@ const _inputId = computed<string>(() => props.inputId || `${computedId.value}inp
247
247
const tags = ref <string []>(modelValue .value )
248
248
const inputValue = ref <string >(' ' )
249
249
const shouldRemoveOnDelete = ref <boolean >(modelValue .value .length > 0 )
250
- const focus = ref <boolean >(false )
251
250
const lastRemovedTag = ref <string >(' ' )
252
251
const validTags = ref <string []>([])
253
252
const invalidTags = ref <string []>([])
@@ -258,7 +257,7 @@ const computedClasses = computed(() => [
258
257
{
259
258
[` form-control-${props .size } ` ]: props .size !== ' md' ,
260
259
disabled: disabledBoolean .value ,
261
- focus: focus .value ,
260
+ focus: focused .value ,
262
261
},
263
262
])
264
263
@@ -334,12 +333,12 @@ const onFocus = (e: FocusEvent): void => {
334
333
return
335
334
}
336
335
337
- focus .value = true
336
+ focused .value = true
338
337
emit (' focus' , e )
339
338
}
340
339
341
340
const onBlur = (e : FocusEvent ): void => {
342
- focus .value = false
341
+ focused .value = false
343
342
emit (' blur' , e )
344
343
}
345
344
@@ -447,4 +446,14 @@ const removeTag = (tag?: string): void => {
447
446
lastRemovedTag .value = tags .value .splice (tagIndex , 1 ).toString ()
448
447
modelValue .value = tags .value
449
448
}
449
+
450
+ // TODO these focus/blur events aren't quite in line with use useFormInput implementation. Perhaps we should bring them together?
451
+ defineExpose ({
452
+ focus : () => {
453
+ focused .value = true
454
+ },
455
+ blur : () => {
456
+ focused .value = false
457
+ },
458
+ })
450
459
</script >
0 commit comments