Make <input type=number> behave honor the 'disabled' attribute, and correctly disable when inside a disabled fieldset

RESOLVED FIXED in Firefox 28

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: jwatt, Assigned: jwatt)

Tracking

Trunk
mozilla29
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox28 fixed, firefox29 fixed)

Details

Attachments

(1 attachment)

The HTML5 spec doesn't mention 'disabled' in the list given after the text "The following common input element content attributes, IDL attributes, and methods apply to the element" for <input type=number>, so I omitted to implement disabling:

http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#number-state-%28type=number%29
Created attachment 8345423 [details] [diff] [review]
patch

This patch remedies things by doing for 'number' what bug 596088 did for 'file', plus a change to nsNativeTheme.cpp to make sure that the spin buttons get the disabled styling too.
Attachment #8345423 - Flags: review?(bugs)

Comment 2

4 years ago
Comment on attachment 8345423 [details] [diff] [review]
patch

>+    NS_IMETHOD Run() MOZ_OVERRIDE {
{ goes to the next line


>@@ -80,16 +80,24 @@ nsNativeTheme::GetContentState(nsIFrame*
>     // anonymous <input type=text> takes focus for it.
>     if (aWidgetType == NS_THEME_NUMBER_INPUT &&
>         frameContent->IsHTML(nsGkAtoms::input)) {
>       nsNumberControlFrame *numberControlFrame = do_QueryFrame(aFrame);
>       if (numberControlFrame && numberControlFrame->IsFocused()) {
>         flags |= NS_EVENT_STATE_FOCUS;
>       }
>     }
>+
>+    nsNumberControlFrame* numberControlFrame =
>+      nsNumberControlFrame::GetNumberControlFrameForSpinButton(aFrame);
>+    if (numberControlFrame &&
>+        numberControlFrame->GetContent()->AsElement()->State().
>+          HasState(NS_EVENT_STATE_DISABLED)) {
>+      flags |= NS_EVENT_STATE_DISABLED;
>+    }
Would be nice to combine this somehow with the stuff above, but don't see now how.
Attachment #8345423 - Flags: review?(bugs) → review+
Please file a spec bug!

Comment 4

4 years ago
I'll file spec bugs for this and select()
https://hg.mozilla.org/integration/mozilla-inbound/rev/acadd89682ec
https://hg.mozilla.org/mozilla-central/rev/acadd89682ec
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Comment on attachment 8345423 [details] [diff] [review]
patch

[Approval Request Comment]
Bug caused by (feature/regressing bug #): N/A
User impact if declined: disabled <input type=number> will not be disabled in v28
Testing completed (on m-c, etc.): landed m-i, merged to m-c
Risk to taking this patch (and alternatives if risky): low and early
String or IDL/UUID changes made by this patch: none

We're early in the cycle so hopefully this is fine to uplift. Probably needed to keep <input type=number> on in v28.
Attachment #8345423 - Flags: approval-mozilla-aurora?
(In reply to Jonathan Watt [:jwatt] from comment #7)
> Bug caused by (feature/regressing bug #): N/A

Or bug 344616 and its dependencies if you need one to blame.
(Assignee)

Updated

4 years ago
Blocks: 344616
Attachment #8345423 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
https://hg.mozilla.org/releases/mozilla-aurora/rev/804a75178265
(Assignee)

Updated

4 years ago
status-firefox28: --- → fixed
Target Milestone: mozilla29 → mozilla28
(TM tracks when it hit m-c, status flags track what branches it's been uplifted to)
status-firefox29: --- → fixed
Target Milestone: mozilla28 → mozilla29
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.