reflex-dom
reflex-dom copied to clipboard
Wrong default value in rangeInput when using Map attributes
In this lpaste 2 ways to initialize a RangeInput are compared:
-
rangeInput $ def & attributes .~ constDyn ("value" =: "4" <> ...)
-
rangeInput $ def & rangeInputConfig_initialValue .~ 4.0 & ...
Here are the 2 corresponding HTML code generated:
-
<input max="3" min="1" step="1" type="range" value="4">
-
<input max="3" min="1" step="1" type="range">
The first way does not take into account the default value ("value" =: "4"
).
Tested with Chrome 65.0.3325.162, Firefox 59.0.1 and Safari 11.0.2.
When generated code is copied to a static HTML file, range inputs behave as expected: the first is set and not the second (default value at the middle of the range).
@jhenligne the issue is not quite clear.. what behavior do you expect ? the initial value should be set irrespective of the max
, min
attributes?
@dfordivam hell is in the details... I adapted my example from different values of real code and forgot to update the default value accordingly. You would have seen it in the lpaste code, but it has shut down meanwhile.
Anyway you can test it with a different range and a default value in the range to get the issue. Of course it is still valid if relevant code has not been fixed since March.