fryn / html5slider

<input type=range> polyfill for Firefox
http://fryn.github.io/html5slider/
180 stars 48 forks source link

Update value on drag #22

Closed syropian closed 11 years ago

syropian commented 11 years ago

See below for reason for not implementing this.

fryn commented 11 years ago

Due to the ambiguity in the specification for input type="range" — see http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#event-input-change — we have decided to make Firefox follow the precedent that other input elements set, which is to only fire change events when the user completes an interaction with the element. In the case of input type="text", change is not fired until the element loses focus. In the case of input type="range", change is not fired until mouseup. See the conclusion of the discussion here: https://bugzilla.mozilla.org/show_bug.cgi?id=851090#c10

Precedents aside, it also does not make sense to fire change events repeatedly during the drag, because then change events fire at the same time and as frequently as input events, so why even have two different event types then?

Therefore, html5slider matches the behavior of Firefox 22 and up, which implement input type="range" natively, and does not match the behavior of WebKit and IE 10 and up, which deviate from the aforementioned precedent.

syropian commented 11 years ago

Understood. I guess you'r aiming towards 'official specification' instead of good UX. In 99% of slider applications I have seen, sliding the slider triggers immediate visual feedback while dragging. It only makes sense really. At least it's easy to modify for my own use (and may I add it works perfectly)

fryn commented 11 years ago

That isn't true. Those applications should be listening for the input event, instead of the change event. When you want to be notified of every change to input type="text" elements in real time, you listen to the input event, not the change event. The same is true for input type="range" elements.

syropian commented 11 years ago

Oops, you're right of course. For some reason my brain got got up on the word 'change'. Had to think for a sec and realize how change events are generally triggered. My bad!

syropian commented 11 years ago

As a side note, adding slider.dispatchEvent(onInput); doesn't live update the slider value on drag. However using onChange does. Why is that?