@@ -262,13 +262,21 @@ export class Checkbox implements ComponentInterface {
262
262
263
263
renderHiddenInput ( true , el , name , checked ? value : '' , disabled ) ;
264
264
265
+ // Determine appropriate accessible name
266
+ const hasLabelContent = el . textContent !== '' ;
267
+ const inputLabelId = inputId + '-lbl' ;
268
+
265
269
return (
270
+ /*
271
+ The host must be a checkbox role to support Safari's Voice Over accessibility
272
+ */
266
273
< Host
267
274
role = "checkbox"
268
275
aria-checked = { indeterminate ? 'mixed' : `${ checked } ` }
269
276
aria-describedby = { this . getHintTextID ( ) }
270
277
aria-invalid = { this . getHintTextID ( ) === this . errorTextId }
271
- aria-labelledby = { inputId + '-lbl' }
278
+ aria-labelledby = { hasLabelContent ? inputLabelId : null }
279
+ aria-label = { ! hasLabelContent ? inheritedAttributes [ 'aria-label' ] || 'checkbox' : null }
272
280
aria-disabled = { disabled ? 'true' : null }
273
281
tabindex = "0"
274
282
onKeyDown = { this . onKeyDown }
@@ -292,8 +300,7 @@ export class Checkbox implements ComponentInterface {
292
300
*/ }
293
301
< input
294
302
type = "checkbox"
295
- aria-hidden = "true"
296
- tabindex = "-1"
303
+ class = "checkbox-native-control"
297
304
checked = { checked ? true : undefined }
298
305
disabled = { disabled }
299
306
id = { inputId }
@@ -307,10 +314,10 @@ export class Checkbox implements ComponentInterface {
307
314
< div
308
315
class = { {
309
316
'label-text-wrapper' : true ,
310
- 'label-text-wrapper-hidden' : el . textContent === '' ,
317
+ 'label-text-wrapper-hidden' : ! hasLabelContent ,
311
318
} }
312
319
part = "label"
313
- id = { inputId + '-lbl' }
320
+ id = { inputLabelId }
314
321
>
315
322
< slot > </ slot >
316
323
{ this . renderHintText ( ) }
0 commit comments