Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to prevent bubbling when power-select is opened #1072

Open
artemgurzhii opened this issue Mar 6, 2018 · 1 comment
Open

Option to prevent bubbling when power-select is opened #1072

artemgurzhii opened this issue Mar 6, 2018 · 1 comment

Comments

@artemgurzhii
Copy link
Contributor

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)

@Glarregle
Copy link

Glarregle commented Jul 26, 2019

@cibernox This would be very useful, any updates on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants