@@ -216,6 +216,22 @@ export const VField = genericComponent<new <T>(
216216 focus,
217217 } ) )
218218
219+ const floatingLabelProps = toRef ( ( ) => {
220+ const ariaHidden = ! isActive . value
221+ return {
222+ 'aria-hidden' : ariaHidden ,
223+ for : ariaHidden ? undefined : id . value ,
224+ }
225+ } )
226+
227+ const mainLabelProps = toRef ( ( ) => {
228+ const ariaHidden = hasFloatingLabel . value && isActive . value
229+ return {
230+ 'aria-hidden' : ariaHidden ,
231+ for : ariaHidden ? undefined : id . value ,
232+ }
233+ } )
234+
219235 function onClick ( e : MouseEvent ) {
220236 if ( e . target !== document . activeElement ) {
221237 e . preventDefault ( )
@@ -304,8 +320,7 @@ export const VField = genericComponent<new <T>(
304320 ref = { floatingLabelRef }
305321 class = { [ textColorClasses . value ] }
306322 floating
307- for = { id . value }
308- aria-hidden = { ! isActive . value }
323+ { ...floatingLabelProps . value }
309324 style = { textColorStyles . value }
310325 >
311326 { label ( ) }
@@ -317,8 +332,7 @@ export const VField = genericComponent<new <T>(
317332 key = "label"
318333 ref = { labelRef }
319334 id = { props . labelId }
320- for = { id . value }
321- aria-hidden = { hasFloatingLabel . value && isActive . value }
335+ { ...mainLabelProps . value }
322336 >
323337 { label ( ) }
324338 </ VFieldLabel >
@@ -410,7 +424,11 @@ export const VField = genericComponent<new <T>(
410424
411425 { hasFloatingLabel . value && (
412426 < div class = "v-field__outline__notch" >
413- < VFieldLabel ref = { floatingLabelRef } floating for = { id . value } aria-hidden = { ! isActive . value } >
427+ < VFieldLabel
428+ ref = { floatingLabelRef }
429+ floating
430+ { ...floatingLabelProps . value }
431+ >
414432 { label ( ) }
415433 </ VFieldLabel >
416434 </ div >
@@ -421,7 +439,7 @@ export const VField = genericComponent<new <T>(
421439 ) }
422440
423441 { isPlainOrUnderlined . value && hasFloatingLabel . value && (
424- < VFieldLabel ref = { floatingLabelRef } floating for = { id . value } aria-hidden = { ! isActive . value } >
442+ < VFieldLabel ref = { floatingLabelRef } floating { ... floatingLabelProps . value } >
425443 { label ( ) }
426444 </ VFieldLabel >
427445 ) }
0 commit comments