From 926969b9212a2fe639d4b87138944e69756dd442 Mon Sep 17 00:00:00 2001 From: orangemug Date: Sun, 19 Jan 2020 11:28:03 +0000 Subject: [PATCH] Always change via step from keyboard. --- src/components/inputs/NumberInput.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/inputs/NumberInput.jsx b/src/components/inputs/NumberInput.jsx index 5d468fe..b474c3c 100644 --- a/src/components/inputs/NumberInput.jsx +++ b/src/components/inputs/NumberInput.jsx @@ -34,6 +34,7 @@ class NumberInput extends React.Component { if (!state.editing) { return { value: props.value, + dirtyValue: props.value, }; } return null; @@ -107,12 +108,13 @@ class NumberInput extends React.Component { // for example we might go from 13 to 13.23, however because we know // that came from a keyboard event we always want to increase by a // single step value. - if (value < this.state.value) { - value = value - snap; + if (value < this.state.dirtyValue) { + value = this.state.value - step; } else { - value = value - snap + snap; + value = this.state.value + step } + dirtyValue = value; } else { if (snap < step/2) {