Skip to content

Commit

Permalink
Merge pull request #4999 from nextcloud-libraries/fix/checkbox-label-…
Browse files Browse the repository at this point in the history
…shift-click-FF
  • Loading branch information
skjnldsv committed Jan 2, 2024
2 parents 5536c8d + b1bfee1 commit 9fd3475
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 6 additions & 10 deletions src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
-->

<template>
<component :is="wrapperElement"
:for="!isButtonType ? id : null"
<!--
label can't be used here because of shift+click firefox bug
https://bugzilla.mozilla.org/show_bug.cgi?id=559506
-->
<span :id="!isButtonType ? `${id}-label` : null"
class="checkbox-content"
:class="{
['checkbox-content-' + type]: true,
Expand Down Expand Up @@ -52,7 +55,7 @@
<!-- @slot The checkbox/radio label -->
<slot />
</span>
</component>
</span>
</template>

<script>
Expand Down Expand Up @@ -166,13 +169,6 @@ export default {
return this.type === TYPE_BUTTON
},
wrapperElement() {
if (this.isButtonType) {
return 'span'
}
return 'label'
},
/**
* Returns the proper Material icon depending on the select case
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export default {
v-on="isButtonType ? listeners : null">
<input v-if="!isButtonType"
:id="id"
:aria-labelledby="!isButtonType && !ariaLabel ? `${id}-label` : null"
:aria-label="ariaLabel || undefined"
class="checkbox-radio-switch__input"
:disabled="disabled"
Expand All @@ -293,7 +294,8 @@ export default {
:button-variant="buttonVariant"
:is-checked="isChecked"
:loading="loading"
:size="size">
:size="size"
@click.native="onToggle">
<template #icon>
<!-- @slot The checkbox/radio icon, you can use it for adding an icon to the button variant -->
<slot name="icon" />
Expand Down

0 comments on commit 9fd3475

Please sign in to comment.