cibernox / ember-power-select

The extensible select component built for ember.
http://www.ember-power-select.com
Other
541 stars 379 forks source link

Add `@rootEventType` argument and set `mousedown` as default #1819

Closed ArnaudWeyts closed 4 months ago

ArnaudWeyts commented 6 months ago

Summary

Description

I noticed that we set eventType to a default of mousedown for the ember-basic-dropdown trigger (see https://github.com/cibernox/ember-power-select/blob/3aec36878c8b2aa9cf335b7a2220ae448c359fa1/ember-power-select/src/components/power-select.hbs#L46C1-L46C47), but we don't set it for rootEventType, which is the event used when clicking outside of the dropdown to open/close. I believe these should be in sync and the default of mousedown makes sense (it's also how a default HTML select behaves).

We ran into this issue because the click event doesn't propagate when the original element is removed from the DOM. Causing selects to not close properly.

ArnaudWeyts commented 6 months ago

Also opened an MR in ember-basic-dropdown to add missing docs: https://github.com/cibernox/ember-basic-dropdown/pull/903