From 4b86428dc7c4bca824bb306f2ffbf934e644ae91 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 9 Nov 2024 20:42:29 +0100 Subject: [PATCH] Limit max and min values of number setting textfield Limits were passed through to the slider but were not applied to the text field --- src/modules/core/components/settings/NumberSetting.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/core/components/settings/NumberSetting.tsx b/src/modules/core/components/settings/NumberSetting.tsx index 65e1b17c..d0cc304c 100644 --- a/src/modules/core/components/settings/NumberSetting.tsx +++ b/src/modules/core/components/settings/NumberSetting.tsx @@ -170,7 +170,10 @@ export const NumberSetting = ({ type="number" onChange={(e) => { const newValue = Number(e.target.value); - updateValue(newValue, false); + const newValueMinLimit = Math.min(newValue, maxValue ?? newValue); + const newValueMaxLimit = Math.max(newValueMinLimit, minValue ?? newValueMinLimit); + + updateValue(newValueMaxLimit, false); }} slotProps={{ input: {