File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/components/src/components/forms/NumberInput Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -201,18 +201,26 @@ export default {
201201 * can be found. It prevents users from further invalidating the value in the input
202202 * by moving in the wrong direction (lower than min/higher than max).
203203 *
204- * @param {Number} increment - the amount by which to change the current value.
204+ * It will snap to the nearest multiple of the given increment, i.e. initial
205+ * value 13 incremented by 10 will yield 20.
206+ *
207+ * @param {Number} increment - the amount by which to change the current
208+ * value. If value is 0, no update is performed.
205209 * @returns {undefined}
206210 */
207211 changeValue(increment : number ) {
212+ if (increment === 0 ) {
213+ return ;
214+ }
215+
208216 let value = this .getParsedValue ();
209217 if (! this .validate (value ).isValid ) {
210218 value = this .findNearestValidValue (value );
211219 }
212220
213221 /** Mimic stepping to nearest step with safe value rounding */
214222 let parsedVal = value + increment ;
215- let scaleFactor = 1 / Math .abs (increment ); // eslint-disable-line no-magic-numbers
223+ let scaleFactor = 1 / Math .abs (increment );
216224 if (Math .abs (increment ) < 1 ) {
217225 // Avoid rounding errors induced by fractional increments
218226 scaleFactor = Math .round (scaleFactor );
You can’t perform that action at this time.
0 commit comments