Skip to content

Instantly share code, notes, and snippets.

@noslouch
Last active June 19, 2018 18:41
Show Gist options
  • Save noslouch/5e74584dff35cb7a2814812abbfe99b8 to your computer and use it in GitHub Desktop.
Save noslouch/5e74584dff35cb7a2814812abbfe99b8 to your computer and use it in GitHub Desktop.
enter inside form sends click event
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
foo() {
this.set('bar', 'set from an enter press');
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'form'
});
<h1>Hitting enter sends the wrong event</h1>
{{my-form}}
<h2>This component is outside the form</h2>
{{my-button}}
<button {{action 'foo'}}>
my own action is 'foo'
</button>
<h3>
{{bar}}
</h3>
<h2>focus the form and hit the enter key:</h2>
{{input}}
<br>
<br>
<h2>This component is in the form:</h2>
{{my-button}}
{
"version": "0.14.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "2.18.2",
"ember-template-compiler": "2.18.2",
"ember-testing": "2.18.2"
},
"addons": {
"ember-data": "2.18.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment