Closed Bug 948549 Opened 10 years ago Closed 10 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29
Tracking Status
firefox28 --- fixed
firefox29 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(1 file)

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
Attached patch patchSplinter Review
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 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!
I'll file spec bugs for this and select()
https://hg.mozilla.org/mozilla-central/rev/acadd89682ec
Status: NEW → RESOLVED
Closed: 10 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.
Blocks: 344616
Attachment #8345423 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Target Milestone: mozilla29 → mozilla28
(TM tracks when it hit m-c, status flags track what branches it's been uplifted to)
Target Milestone: mozilla28 → mozilla29
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: