-
-
Notifications
You must be signed in to change notification settings - Fork 263
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using contraints Min or Max (or Precission), inputting value out of bounds will display corrected value only for the first change. For example with max set to 10:
- After first 1000 input, corrected 10 is displ.ayed
- Entering 1000 again and submitting using enter will not display 10 although internally 10 should be the current value
The reason behind this seems to be that the component does not use :get and :set modifiers for binding.
Changing the code to use the modifiers seems to fix the issue:
<input @ref="InputElement" @attributes="@InputHtmlAttributes"
@onblur="HandleOnBlur"
@onfocus="HandleOnFocus"
@onkeydown="HandleOnKeyDown"
@onfocusin="HandleOnFocusIn"
@onfocusout="HandleOnFocusOut"
@onwheel="HandleOnMouseWheel"
form=""
min="@_min"
max="@_max"
name="@Name"
step="@_step"
id="@_inputId"
readonly="@(ReadOnly || IsInputReadOnly)"
required="@Required"
style="@Styles?.Input"
autofocus="@AutoFocus"
inputmode="@_inputMode"
placeholder="@Placeholder"
aria-labelledby="@_labelId"
@bind-value:get="@CurrentValueAsString"
@bind-value:set="val => Immediate ? HandleOnStringValueInputAsync(new ChangeEventArgs() { Value = val }) : HandleOnStringValueChangeAsync(new ChangeEventArgs() { Value = val })"
@bind-value:event="@(Immediate ? "oninput" : "onchange")"
disabled="@(IsEnabled is false)"
class="bit-nfl-inp@(Mode == BitSpinButtonMode.Spread ? " bit-nfl-cin" : "") @Classes?.Input"
autocomplete="@(AutoComplete ?? "off")"
type="text"
aria-valuemin="@_min"
aria-valuemax="@_max"
aria-describedby="@AriaDescription"
aria-valuenow="@(AriaValueNow ?? CurrentValue)"
aria-valuetext="@(AriaValueText ?? CurrentValueAsString)"
aria-disabled="@(IsEnabled is false)" />Expected Behavior
The component should display the current value after correction and not the invalid out of bound value after value change.
Steps To Reproduce
Reproducible in the documentation examples.
- Enter value out of bounds
- Press enter
- Value clamped to the limits and displayed
- Enter out of bounds again
- Press enter
- Displayed value stays the same
Exceptions (if any)
No response
.NET Version
.net 10
Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done

