@@ -31,6 +31,7 @@ import type { CheckboxChangeEventDetail } from './checkbox-interface';
3131} )
3232export class Checkbox implements ComponentInterface {
3333 private inputId = `ion-cb-${ checkboxIds ++ } ` ;
34+ private inputLabelId = `${ this . inputId } -lbl` ;
3435 private helperTextId = `${ this . inputId } -helper-text` ;
3536 private errorTextId = `${ this . inputId } -error-text` ;
3637 private focusEl ?: HTMLElement ;
@@ -264,7 +265,6 @@ export class Checkbox implements ComponentInterface {
264265
265266 // Determine appropriate accessible name.
266267 const hasLabelContent = el . textContent !== '' ;
267- const inputLabelId = inputId + '-lbl' ;
268268
269269 // The host element must have a checkbox role to ensure proper VoiceOver
270270 // support in Safari for accessibility.
@@ -274,7 +274,7 @@ export class Checkbox implements ComponentInterface {
274274 aria-checked = { indeterminate ? 'mixed' : `${ checked } ` }
275275 aria-describedby = { this . getHintTextID ( ) }
276276 aria-invalid = { this . getHintTextID ( ) === this . errorTextId }
277- aria-labelledby = { hasLabelContent ? inputLabelId : null }
277+ aria-labelledby = { hasLabelContent ? this . inputLabelId : null }
278278 aria-label = { ! hasLabelContent ? inheritedAttributes [ 'aria-label' ] || 'checkbox' : null }
279279 aria-disabled = { disabled ? 'true' : null }
280280 tabindex = { disabled ? undefined : 0 }
@@ -315,7 +315,7 @@ export class Checkbox implements ComponentInterface {
315315 'label-text-wrapper-hidden' : ! hasLabelContent ,
316316 } }
317317 part = "label"
318- id = { inputLabelId }
318+ id = { this . inputLabelId }
319319 >
320320 < slot > </ slot >
321321 { this . renderHintText ( ) }
0 commit comments