ember-power-select icon indicating copy to clipboard operation
ember-power-select copied to clipboard

Double mouse events with closeOnSelect=false

Open sukima opened this issue 8 years ago • 2 comments

This is a weird one and really only noticeable when the trigger component is rendered in such a way that the pills stack vertically. I replicated it in this ember-twiddle.

To reproduce

  1. Open the drop down
  2. click the X on "Blow Pops"
  3. Notice both "Blow Pops" and "Reese's pieces" are removed.

This is because the mousedown is triggered on the button causing the pill to be removed and the drop down menu moves up by that same amount. The cursor is now over the first option. Then the mouseup event is triggered on the first option. This fires the onchange action twice.

power-select-bug

sukima avatar May 30 '17 20:05 sukima

I see. Yep, that's unfortunate. I'll try to allocate some time to dig into a possible solution

cibernox avatar May 30 '17 22:05 cibernox

I see. Yep, that's unfortunate. I'll try to allocate some time to dig into a possible solution

I am having the same issue on v2.3.5. The problem seems gone if the listening event is changed from mousedown to mouseup (https://github.com/cibernox/ember-power-select/blob/v2.3.5/addon/components/power-select-multiple/trigger.js#L43).

Edit: With a simple replace of mousedown with mouseup, the dropdown close upon clicking the X, which is not the original behavior with closeOnSelect=false. I ended up with a workaround by keeping the mousedown listener but remove choose action from it. Ember twiddle for reference.

lacek avatar Apr 29 '20 10:04 lacek