Closed claviska closed 1 year ago
This feels more like a bug/quirk with the browsers. When I get on tomorrow, I will do some digging and see if this should be fixed upstream. Might also be a good thing for lit-plugin instead.
UPDATE: After further discussion, it definitely deserves some kind of warning either here or lit-plugin but that's up to @43081j
i wouldn't call it a bug (with browsers or with lit) but agree we should warn people about it.
logically, its the same as:
const node = document.querySelector('input');
node.value = '40';
node.max = '30'; // this won't change the existing value, it'll just set the new maximum
we could have a rule to just check the order is right and value
comes after everything else.
When binding
value
on an input beforemin
andmax
, the value is clamped to the defaultmin
andmax
values, resulting in what appears to be buggy behavior. Note howvalue
binds beforemin|max
:Playground
The last slider is rendered incorrectly, and the internal input has an initial value of
0
. Now let's move thevalue
binding aftermin|max
:Playground
Now the control renders as expected. Since this isn't obvious, and
value
is often one of the first things users bind to an input, it's probably worth adding a rule to call out whenvalue
binds beforemin
ormax
.