Skip to content

Commit

Permalink
Merge pull request #4903 from nextcloud-libraries/enh/allow-aria-labe…
Browse files Browse the repository at this point in the history
…l-on-checkbox

enh(NcCheckboxRadioSwitch): Allow to set `aria-label`
  • Loading branch information
Pytal authored Dec 1, 2023
2 parents 5cc6c04 + 85bb472 commit 8a2c612
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export default {
<template>
<component :is="computedWrapperElement"
:id="wrapperId"
:aria-label="isButtonType && ariaLabel ? ariaLabel : undefined"
:class="{
['checkbox-radio-switch-' + type]: type,
'checkbox-radio-switch--checked': isChecked,
Expand All @@ -276,6 +277,7 @@ export default {
v-on="isButtonType ? listeners : null">
<input v-if="!isButtonType"
:id="id"
:aria-label="ariaLabel || undefined"
class="checkbox-radio-switch__input"
:disabled="disabled"
:type="inputType"
Expand Down Expand Up @@ -344,6 +346,15 @@ export default {
default: null,
},
/**
* Required if no text is set.
* The aria-label is forwarded to the input or button.
*/
ariaLabel: {
type: String,
default: '',
},
/**
* Type of the input. checkbox, radio, switch, or button.
*
Expand Down

0 comments on commit 8a2c612

Please sign in to comment.