Skip to content

[Bug Report] Cannot have a radio box corresponding to a null value #9073

@naffarn

Description

@naffarn

Environment

Vuetify Version: 2.0.18
Vue Version: 2.6.10
Browsers: Chrome 76.0.3809.132
OS: Linux x86_64

Steps to reproduce

Create a <v-radio-group /> with one <v-radio :value="null" />. That v-radio's value will actually correspond to its index in the group instead of the null :value passed to it.
The following snippet produces values true, false, and 2 in the bound model when selected in order:

<v-radio-group v-model="selected">
    <v-radio label="Yes" :value="true"></v-radio> <!-- selected === true -->
    <v-radio label="No" :value="false"></v-radio> <!-- selected === false -->
    <v-radio label="N/A" :value="null"></v-radio> <!-- selected === 2 -->
</v-radio-group>

Expected Behavior

The value assigned to the radio group model should equal the value assigned to the selected box at all times, in this case, null.

Actual Behavior

The value of the bound model is equal to the null radio's index, rather than the value prop passed in.

Reproduction Link

https://codepen.io/naffarn/pen/eYObxgE

Other comments

This is not an issue for checkboxes and switches that share a v-model for an array.

Metadata

Metadata

Assignees

Labels

C: VRadioT: bugFunctionality that does not work as intended/expected

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions