Closed jamesst20 closed 5 months ago
ID value is based on name
property, which defines name
property of underlying <select>
element. So typically you want to name your Svelecte components correctly.
If you don't use HTML forms for submitting data, you can set name
to empty string. In that case underlying <select>
is not rendered at all and the warning should disappear.
ID value is based on
name
property, which definesname
property of underlying<select>
element. So typically you want to name your Svelecte components correctly.If you don't use HTML forms for submitting data, you can set
name
to empty string. In that case underlying<select>
is not rendered at all and the warning should disappear.
<Svelecte
name={""}
[DOM] Found 4 elements with non-unique id #sv--select-input:
There is 2 consecutive -
so it appears to not work
Okay, this is then extended to <input>
element. And because name
is empty, they have the same id. Set inputId
property and warnings will disappear.
It will be fixed eventually, but not right now.
Hi,
Simply a quick question, does Svelecte have any use for the element ID it uses internally?
Personally I don't make any use of IDs in my projects, however I always end up having this warning
so I always end up wrapping it in a component to generate random ID (name) to get rid of the warning.
I think it's a good thing to be able to pass an ID, but maybe we could leave it unset if it's undefined?