Closed Bug 1286509 Opened 8 years ago Closed 8 years ago

Range input does not fire ‘change’ event when the range is changed using the keyboard.

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox50 --- fixed
firefox51 --- fixed

People

(Reporter: swood, Assigned: stone)

References

Details

Attachments

(3 files, 2 obsolete files)

Range input does not fire ‘change’ event when the range is changed using the keyboard. Keyboard arrow keys cause the slider to visibly shift along, however the ‘change’ event does not fire. Can be replicated by creating an input of type "range" and listening for the change event with JavaScript. Adjusting the input with the keyboard does not fire the 'change' event.
Attached file JS Fiddle Example
Assignee: nobody → sshih
Attachment #8776852 - Flags: feedback?(btseng)
Comment on attachment 8776852 [details] [diff] [review] Range input does not fire ‘change’ event when the range is changed using the keyboard. Review of attachment 8776852 [details] [diff] [review]: ----------------------------------------------------------------- feedback+ after the following issue is addressed. ::: dom/html/HTMLInputElement.cpp @@ +3762,5 @@ > frame->InvalidateFrame(); > } > + } > + } > + if (aVisitor.mEvent->mMessage == eKeyUp && aVisitor.mEvent->IsTrusted()) { nit: please add new line above this line. ::: dom/html/HTMLInputElement.h @@ +1504,5 @@ > + bool MayFireChangeOnKeyUp(uint32_t aKeyCode) const { > + return MayFireChangeOnKeyUp(mType, aKeyCode); > + } > + > + static bool MayFireChangeOnKeyUp(uint8_t aType, uint32_t aKeyCode); This static one looks unnecessary unless we need to handle something similar in HTMLInputElement::HandleTypeChange().
Attachment #8776852 - Flags: feedback?(btseng) → feedback+
Attachment #8777764 - Flags: review?(bugs)
So change does fire, but only after focus moves elsewhere.
Comment on attachment 8777764 [details] [diff] [review] Range input does not fire ‘change’ event when the range is changed using the keyboard. Nice and simple. thanks. Could you perhaps still add a test ensuring we get the right order for keydown/change/keyup (I think that is wrong, but that is what other browsers have too. IMO it should be keydown/keyup/change, but risky to change that.)
Attachment #8777764 - Flags: review?(bugs) → review+
Comment on attachment 8778226 [details] [diff] [review] Range input does not fire ‘change’ event when the range is changed using the keyboard. Added test to check the event sequence and updated patch summary
Attachment #8778226 - Flags: review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/85105a2f62d2 Range input does not fire ‘change’ event when the range is changed using the keyboard. r=smaug
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Blocks: 1295719
Approval Request Comment [Feature/regressing bug #]: regression fix for bug 1291839 [User impact if declined]: using the keyboard to change narration speed in Reader Mode has no effect [Describe test coverage new/current, TreeHerder]: automated tests and baked on central and aurora [Risks and why]: n/i for Stone for risk assessment [String/UUID change made/needed]: none
Flags: needinfo?(sshih)
Attachment #8799519 - Flags: approval-mozilla-beta?
[Risks and why]: The risk of this patch should be low. But there are some problems of this patch so that we have to uplift it with the patch of 1295719 at the same time.
Flags: needinfo?(sshih)
Comment on attachment 8799519 [details] [diff] [review] Patch for beta50 uplift Reader mode shipped in Fx49, we should be incrementally improving its quality, Beta50+
Attachment #8799519 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: