ember-power-select
ember-power-select copied to clipboard
Option to prevent bubbling when power-select is opened
My use case
<div {{action 'openSomething'}}>
<div {{action 'editMode' bubbles=false}}>Edit something</div>
{{#power-select
options=options
selected=selected
onchange=(action 'onchange')
as |option|}}
<span>{{option.name}}</span>
{{/power-select}}
</div>
What I need - is to prevent openSomething
action from firing, when I'm trying to open power-select
menu.
This can be done by changing components/power-select.js#onopen action, with the following code
ember-power-select/addon/components/power-select.js
onOpen(_, e, options) {
// Some code
if (options.bubbles === false) {
e.preventDefault();
}
// Rest of the code
}
and use it like this
myapp/component/open-something.js
onopen() {
this.performSomeCustomLogic();
this._super(...arguments, { bubbles: false });
}
I can make a PR for this if you find this idea reasonable. And thank you for the awesome addon)
@cibernox This would be very useful, any updates on it?