diff --git a/apps/readest-app/src/app/reader/components/settings/NumberInput.tsx b/apps/readest-app/src/app/reader/components/settings/NumberInput.tsx index acba0366..a03c3bc1 100644 --- a/apps/readest-app/src/app/reader/components/settings/NumberInput.tsx +++ b/apps/readest-app/src/app/reader/components/settings/NumberInput.tsx @@ -25,11 +25,17 @@ const NumberInput: React.FC = ({ const numberStep = step || 1; const handleChange = (e: React.ChangeEvent) => { - const newValue = e.target.value === '' ? 0 : parseFloat(e.target.value); - setLocalValue(newValue); - if (!isNaN(newValue)) { - const roundedValue = Math.round(newValue * 10) / 10; - onChange(Math.max(min, Math.min(max, roundedValue))); + const value = e.target.value; + + // Allow empty string or valid numbers without leading zeros + if (value === '' || /^[1-9]\d*\.?\d*$|^0?\.?\d*$/.test(value)) { + const newValue = value === '' ? 0 : parseFloat(value); + setLocalValue(newValue); + + if (!isNaN(newValue)) { + const roundedValue = Math.round(newValue * 10) / 10; + onChange(Math.max(min, Math.min(max, roundedValue))); + } } }; @@ -59,6 +65,7 @@ const NumberInput: React.FC = ({