Skip to content

Commit 8a2c612

Browse files
authored
Merge pull request #4903 from nextcloud-libraries/enh/allow-aria-label-on-checkbox
enh(NcCheckboxRadioSwitch): Allow to set `aria-label`
2 parents 5cc6c04 + 85bb472 commit 8a2c612

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ export default {
260260
<template>
261261
<component :is="computedWrapperElement"
262262
:id="wrapperId"
263+
:aria-label="isButtonType && ariaLabel ? ariaLabel : undefined"
263264
:class="{
264265
['checkbox-radio-switch-' + type]: type,
265266
'checkbox-radio-switch--checked': isChecked,
@@ -276,6 +277,7 @@ export default {
276277
v-on="isButtonType ? listeners : null">
277278
<input v-if="!isButtonType"
278279
:id="id"
280+
:aria-label="ariaLabel || undefined"
279281
class="checkbox-radio-switch__input"
280282
:disabled="disabled"
281283
:type="inputType"
@@ -344,6 +346,15 @@ export default {
344346
default: null,
345347
},
346348
349+
/**
350+
* Required if no text is set.
351+
* The aria-label is forwarded to the input or button.
352+
*/
353+
ariaLabel: {
354+
type: String,
355+
default: '',
356+
},
357+
347358
/**
348359
* Type of the input. checkbox, radio, switch, or button.
349360
*

0 commit comments

Comments
 (0)