This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27432 - The current [WHATWG] spec text for <input type=number> stepping can cause stepping in the opposite direction to the one requested
Summary: The current [WHATWG] spec text for <input type=number> stepping can cause ste...
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P1 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2014-11-25 17:08 UTC by Jonathan Watt
Modified: 2015-07-09 12:12 UTC (History)
4 users (show)

See Also:


Description Jonathan Watt 2014-11-25 17:08:12 UTC
Right now Mozilla's <input type=number> stepping code has checks and tests to make sure that a step up never causes the value to decrease, and a step down never causes the value to increase. The current spec text seems to cause this to happen in certain circumstances. For example,

  data:text/html,<input type=number value=1 max=0>

Actually, checking Chrome I see that they prevent a stepUp() on that example from changing the value too, so it's not just Firefox.

We essentially prevent this by having a step between steps 8 and 9 that causes us to abort if we're doing a step up and 'value' is less than the value before the step was initiated, and a similar check for step down.
Comment 1 Michael[tm] Smith 2015-06-16 10:23:59 UTC
Making this a higher priority to actively seek more feedback on from implementers and webdevs.
Comment 2 Philippe Le Hegaret 2015-07-08 19:17:34 UTC

This does two things:

1. modify step 5 to add a variable "current value"

5. If applying the algorithm to convert a string to a number to the string given by the element's value does not result in an error, then let value be the result of that algorithm. Otherwise, let value be zero. Let current value be the same as value.

2. Insert two steps before step 9 (which becomes step 11 below)

9. If the method invoked was the stepDown() method and value is greater than current value, abort these steps.

10. If the method invoked was the stepUp() method and value is less than current value, abort these steps.

11. Let value as string be the result of running [...]
Comment 3 Philippe Le Hegaret 2015-07-09 12:12:15 UTC
merged. Please reopen if further action is needed.