Subscribe on changes!

`value` attribute not rendered correctly

avatar
Dec 22nd 2021

Version

3.2.26

Reproduction link

sfc.vuejs.org/

Steps to reproduce

inspect the page and find the li element

What is expected?

the element's value attribute is set to "charlie"

What is actually happening?

the element's value attribute is set to "0"


I ran into this while using https://www.npmjs.com/package/@headlessui/vue. Using their listbox component, I expected the value attribute to be set correctly on the listbox items. After lots of investigation, I found the issue was in vue and not specific to @headlessui.

avatar
Dec 22nd 2021

This is the browser setting it as by spec, you can only use numbers: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attr-value