Skip to content

InputMenu/Select/SelectMenu: show falsy label when model value is falsy #4869

@maximepvrt

Description

@maximepvrt

Environment


  • Operating System: Darwin
  • Node Version: v20.19.2
  • Nuxt Version: -
  • CLI Version: 3.28.0
  • Nitro Version: -
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Package

v3.x

Version

v3.3.3

Reproduction

https://stackblitz.com/edit/github-mj4wqh54?file=app%2Fpages%2Findex.vue

Description

When using InputMenu, Select or SelectMenu, if the modelValue is null (or another falsy value) and an option with this value exists, its label is not displayed.

Expected behavior:
If an option with a null (or falsy) value is present in the options, its label should be displayed when selected.

Example:

<USelect
        v-model="value"
        :items="[
          { name: '- Tout -', slug: null },
          { name: 'Sport', slug: 'sport' },
          { name: 'Culture', slug: 'culture' },
        ]"
        value-key="slug"
        label-key="name"
      />

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagev3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions