Closed Bug 1172086 Opened 9 years ago Closed 9 years ago

Empty, but disabled <input> with associated <datalist> incorrectly allows input


(Firefox for Android Graveyard :: General, defect)

Not set


(firefox41 fixed)

Firefox 41
Tracking Status
firefox41 --- fixed


(Reporter: capella, Assigned: p.calligaris.code, Mentored)


(Whiteboard: [lang=js][good first bug])


(1 file, 2 obsolete files)

See the example testcase [0]

Initially tapping the disabled <input> provides the dropdown datalist, and allows item selection via tap.

Interestingly, once the field is populated, subsequent tapping behaviour is as expected (not allowed).

This is a fairly simple bug for a new contributor with basic Javascript skills, to learn the Mozilla development process.

You should have an android device for testing your solution locally, and should be able to build Firefox Mobile on your desktop. See [1] for instructions if this is new to you, and ask questions on irc channels #introduction or #mobile.

After building and testing to confirm that you can reproduce the issue, you can review the method / code that is at play here [2]. You should be able to enhance the first method it calls |_isAutoComplete()| [3] to fail in this additional situation, to solve the problem.

Mentor: markcapella
Whiteboard: [lang=js][good first bug]
Can I take it?
The bug will be assigned to whoever can attach a viable patch for review. If you've completed the requirements as in comment #1, please post your work.
Attached patch Proposed Patch (obsolete) — Splinter Review
Here there is a proposed patch. 

The attribute disabled ( is a boolean attribute ( I quote 

"The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value."   

Then it is sufficient to check if there is or not the attribute using the method .hasAttribute .

Is it right?

I built and check the patch on my android device and seems to work.
Close! We normally prefer the use of the element property vs. it's attribute ... can you try
|aElement.disabled| ?

This is normally preferred as simpler and easier to quickly read, and also sometimes for visible controls actually more correct. See additional reading [0], and [1].


Also, a slight style "nit" for your patch, I don't think it'll be necessary to wrap the new condition in parens
|(aElement.hasAttribute("disabled"))| vs. |aElement.hasAttribute("disabled")|

(See the earlier free-standing condition for |aElement.readOnly|)
Assignee: nobody → p.calligaris.code
Attached patch Updated Proposed Patch (obsolete) — Splinter Review
I updated the patch as you suggested. Thank you for the useful links!
Attachment #8616384 - Attachment is obsolete: true
This looks fine, and wfm locally ... let's push to TRY / automated test-farm.

If this works ok, we'll have you change |r=reviewers| to |r=margaret| in your patch commit message, and re-post flagging her for review=?
Ok, (as expected), this looks fine. As mentioned in the previous comment, go ahead and:

1) change |r=reviewers| to |r=margaret| in your patch commit message
2) repost the new patch, and flag it for her review
Last proposed patch. Thanks for the help Mark!
Attachment #8616451 - Attachment is obsolete: true
Attachment #8616875 - Flags: review?(margaret.leibovic)
Comment on attachment 8616875 [details] [diff] [review]

Review of attachment 8616875 [details] [diff] [review]:

Looks great, thanks! And thanks to capella for mentoring!
Attachment #8616875 - Flags: review?(margaret.leibovic) → review+
Keywords: checkin-needed
Whiteboard: [lang=js][good first bug] → [lang=js][good first bug][fixed-in-fx-team]
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [lang=js][good first bug][fixed-in-fx-team] → [lang=js][good first bug]
Target Milestone: --- → Firefox 41
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.