iro.js icon indicating copy to clipboard operation
iro.js copied to clipboard

Event input:start fired twice for single click

Open RickMohr opened this issue 4 years ago • 3 comments

If you single click on an iro.ui.Box (not on the handle) the input:start event is fired twice. Please see this pen:

https://codepen.io/RickMohr/pen/ExXXrOB

Open the console, and click on the box -- "input:start" is printed twice. ( It is correctly printed only once if you drag the box's handle or interact with the slider instead of the box.)

RickMohr avatar Sep 13 '21 16:09 RickMohr

Also I believe input:change is sent before input:start, which seems incorrect.

RickMohr avatar Sep 13 '21 18:09 RickMohr

Hey, thanks for the report! Unfortunately I don't have the time to look into this at the moment...

My best guess is that this is because I'm adding event listeners for both mouse events and the equivalent touch events, and they're both firing with user input. Might be time to move to pointer events (if browser support is consistent yet?) or perhaps just cancel one event if the other has just been fired. If someone could look into it and confirm this, it would be super appreciated :)

jaames avatar Sep 14 '21 10:09 jaames

Hi, looks like only input:start is emitted regardless of actual event(start, move, end). This explains the two input:start; one for click down and one for click up. Would be many more if it is movement in between.

I also didn't have time to go deeper but if (type === 0 /* Start */) is always true

aditzu09 avatar Feb 11 '22 15:02 aditzu09