Closed
Description
I'm submitting a feature request.
I ran into some behavior I didn't expect in radios fields. It seems logical that setting disabled: true
on a single option would result in disabled="disabled"
on that particular option. However, options are only disabled when the whole radios field is disabled. I looked at fieldRadios.vue and to me it seems like the most simple solution would be to change this:
<template lang="pug">
.radio-list(:disabled="disabled", v-attributes="'wrapper'")
label(v-for="item in items", :class="{'is-checked': isItemChecked(item)}", v-attributes="'label'")
input(:id="getFieldID(schema)", type="radio", :disabled="disabled", :name="id", @click="onSelection(item)", :value="getItemValue(item)", :checked="isItemChecked(item)", :class="schema.fieldClasses", :required="schema.required", v-attributes="'input'")
| {{ getItemName(item) }}
into this:
<template lang="pug">
.radio-list(:disabled="disabled", v-attributes="'wrapper'")
label(v-for="item in items", :class="{'is-checked': isItemChecked(item), 'is-disabled': disabled || item.disabled}", v-attributes="'label'")
input(:id="getFieldID(schema)", type="radio", :disabled="disabled || item.disabled", :name="id", @click="onSelection(item)", :value="getItemValue(item)", :checked="isItemChecked(item)", :class="schema.fieldClasses", :required="schema.required", v-attributes="'input'")
| {{ getItemName(item) }}
This makes sure that a radio option is disabled whenever its parent is disabled entirely and whenever that particular option is disabled itself.
Example (expected behavior after option label):
https://jsfiddle.net/Anoesj/qd8fv430/
Version: 2.3.2