Closed Bug 982189 Opened 6 years ago Closed 6 years ago

Readonly input type="number" can still be changed through arrows


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

Not set



Tracking Status
firefox30 + fixed
firefox31 --- verified
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed


(Reporter: cork, Assigned: Agi)



(Keywords: testcase)


(2 files, 1 obsolete file)

Attached file testcase
Input field type number can still be changed through the arrows even if readonly is set.

 1. Load a new clean profile
 2. Load testcase
 3. Click the up or down arrow in the input field

Expected result:
 Nothing should happen as the field is readonly.

Actual result:
 The value of the field is modified.
This should do the trick. The element wasn't checking at all if it was mutable.
Attachment #8394551 - Flags: review?(jwatt)
Duplicate of this bug: 988870
(I noted this in the dupe, but the patch seems to address the keyboard up/down arrows only (which also mutate the value, even if readonly), not the mouse input case)
OK, I'll work on the rest then (the arrows are still broken with the patch above). Can someone assign me this bug? Thanks!
Assignee: nobody → agi.novanta
Great, thanks!
OK this should work! Thank you.
Attachment #8394551 - Attachment is obsolete: true
Attachment #8394551 - Flags: review?(jwatt)
Attachment #8398686 - Flags: review?(jst)
Comment on attachment 8398686 [details] [diff] [review]
Fix Input type="number" immutability

Looks good!
Attachment #8398686 - Flags: review?(jst) → review+
Pushed to Try server (I accidentally used the message from another patch):

The mochitest-dt failed for some weird reason, re-pushed again here:

Everything seems fine.
Keywords: checkin-needed
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Verified using the testcase that the value can no longer be modified using the spin buttons or the up / down arrow keys on latest Nightly (buildID: 20140427030204) under Win 7 64-bit, Ubuntu 32-bit and Mac OSX 10.8.5.
QA Contact: petruta.rasa
Duplicate of this bug: 1004905
Duplicate of this bug: 1009435
Agi, shouldn't this be uplifted to beta considering the increasing no of duplicates?
Flags: needinfo?(agi.novanta)
Duplicate of this bug: 1009578
Comment on attachment 8398686 [details] [diff] [review]
Fix Input type="number" immutability

I was thinking about it. Let's try.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 935506
User impact if declined: Number input can be changed even if disabled
Testing completed (on m-c, etc.):  the patch has been verified and has been in m-c for a few days now
Risk to taking this patch (and alternatives if risky): the patch is reasonably safe, shouldn't pose any risk
String or IDL/UUID changes made by this patch: none
Attachment #8398686 - Flags: approval-mozilla-beta?
Attachment #8398686 - Flags: approval-mozilla-aurora?
Flags: needinfo?(agi.novanta)
Comment on attachment 8398686 [details] [diff] [review]
Fix Input type="number" immutability

We're in our final week of taking speculative fixes on Beta so we'll take this and make sure that we get the most bake time before ship. Will mark for tracking so this stays on our radar should there be any regressions or backout needed.
Attachment #8398686 - Flags: approval-mozilla-beta?
Attachment #8398686 - Flags: approval-mozilla-beta+
Attachment #8398686 - Flags: approval-mozilla-aurora?
Attachment #8398686 - Flags: approval-mozilla-aurora+
Thanks for the approval Lukas. I just applied the patch on my local copy of mozilla-beta and everything seems fine. 

Thank you!
Keywords: checkin-needed

This landed on trunk during the Gecko31 cycle, so this is already fixed on Aurora.
Marking as verified on 31 based on comment 11.
Still can see spinner's arrows in FF 34
<input placeholder="zzz" class="zzz" id="zzzz" name="zzzzz" readonly="True" step="0.01" type="number">

Chrome 37.0.2062.120 m hides them.
Sorry, input[type="number"][readonly] {
		-moz-appearance: textfield;
	input[type="number"][readonly]::-webkit-inner-spin-button {
		-webkit-appearance: none;
works well.
You need to log in before you can comment on or make changes to this bug.