Closed Bug 1892865 Opened 6 months ago Closed 6 months ago

[wpt-sync] Sync PR 45838 - StepDown should default to min when no current val

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 45838 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/45838
Details from upstream follow.

Traian Captan <tcaptan@chromium.org> wrote:

StepDown should default to min when no current val

When stepDown() is called on an input box that has a minimum value
defined that is greater than zero and no current value, no value is
set.

This can seem unintuitive to users and mismatches what currently
happens when the user uses the spinner or keyboard down arrow.

The reason for nothing seeming to happen is due to interpretation of
step 10 in the stepDown(n) method specified algorithm [1]:
"10. If either the method invoked was the stepDown() method and value
is greater than valueBeforeStepping, or the method invoked was the
stepUp() method and value is less than valueBeforeStepping, then
return."

when applying the default value in step 5:
"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."

If the minimum value defined for the input is greater than the default
of zero, the check in step 10 fails and an early return is executed.

The proposed fix for this is to keep track of whether there was an
actual valueBeforeStepping (current value) or the default is used,
and execute the early return defined in step 10 only if the default
was not used. This will result in a more intuitive behavior for the
users, and align the stepDown() behavior in this case with the
spinner/keyboard arrow down behavior and also match FireFox.

[1]https://html.spec.whatwg.org/multipage/input.html#dom-input-stepup

Bug: 40692746
Change-Id: Ie4cabb9169911f8c8cb0149c716133f0a1951cb8
Reviewed-on: https://chromium-review.googlesource.com/5474199
WPT-Export-Revision: 29841ac10691cdb2480bd51a017d44c6d85eb59a

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests and 6 subtests

Status Summary

Firefox

OK : 1
PASS: 6

Chrome

OK : 1
PASS: 5
FAIL: 1

Safari

OK : 1
PASS: 5
FAIL: 1

Links

GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/69501a0606fa [wpt PR 45838] - StepDown should default to min when no current val, a=testonly
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.