Skip to content

Instantly share code, notes, and snippets.

@alexlafroscia
Last active January 26, 2017 18:10
Show Gist options
  • Save alexlafroscia/b73f14c5c865e05b6e39bb788d051d31 to your computer and use it in GitHub Desktop.
Save alexlafroscia/b73f14c5c865e05b6e39bb788d051d31 to your computer and use it in GitHub Desktop.
Dismiss popover on link focus-out
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
popoverVisible: false,
actions: {
showPopover() {
this.set('popoverVisible', true);
},
hidePopover() {
this.set('popoverVisible', fales);
}
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
a:focus {
color: red;
}
<a href="" {{action 'showPopover'}} {{action 'hidePopover' on='focusOut'}}>
Trigger Popover
</a>
<br />
{{#if popoverVisible}}
This is a (fake) popover
{{/if}}
{
"version": "0.11.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment