Skip to content

Commit cd8648b

Browse files
authored
Merge pull request #3690 from AnnMarieW/fix-3689-input-min-max
Fix input when min or max is None
2 parents d2e5bbe + bc52e55 commit cd8648b

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [UNRELEASED]
6+
7+
## Fixed
8+
- [#3690](https://github.com/plotly/dash/pull/3690) Fixes Input when min or max is set to None
9+
510
## [4.1.0] - 2026-03-23
611

712
## Added

components/dash-core-components/src/components/Input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ function Input({
188188

189189
// Apply min/max constraints
190190
let constrainedValue = newValue;
191-
if (props.min !== undefined) {
191+
if (props.min !== null && props.min !== undefined) {
192192
constrainedValue = Math.max(
193193
constrainedValue,
194194
parseFloat(props.min as string)
195195
);
196196
}
197-
if (props.max !== undefined) {
197+
if (props.max !== null && props.min !== undefined) {
198198
constrainedValue = Math.min(
199199
constrainedValue,
200200
parseFloat(props.max as string)

components/dash-core-components/tests/integration/input/test_number_input.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,29 @@ def test_inni010_valid_numbers(dash_dcc, ninput_app):
253253
dash_dcc.clear_input(elem)
254254

255255
assert dash_dcc.get_logs() == []
256+
257+
258+
def test_inni011_min_max_bug(dash_dcc):
259+
"""Test that decrement increment button works correctly with min/max set to None."""
260+
261+
app = Dash(__name__)
262+
app.layout = html.Div(
263+
[
264+
dcc.Input(id="number", value=17, type="number", min=None, max=None),
265+
html.Div(id="output"),
266+
]
267+
)
268+
269+
@app.callback(Output("output", "children"), [Input("number", "value")])
270+
def update_output(val):
271+
return val
272+
273+
dash_dcc.start_server(app)
274+
275+
decrement_btn = dash_dcc.find_element(".dash-stepper-decrement")
276+
277+
# Initial value is 17, should be able to decrement to 16
278+
decrement_btn.click()
279+
dash_dcc.wait_for_text_to_equal("#output", "16")
280+
281+
assert dash_dcc.get_logs() == []

0 commit comments

Comments
 (0)