The onkeydown action handler does not bubble up the keydown action result back up to the ember-power-select. So if the handler wanted to stop the event, EPS never sees the request to stop processing.
The code for onKeyDown method in component/ember-power-select-typeahead.js is:
onKeyDown(select, e) {
let action = this.get('onkeydown');
// if user passes `onkeydown` action
if (!action || action(select, e) !== false) {
// if escape, then clear out selection
if (e.keyCode === 27) {
select.actions.choose(null);
}
}
}
It really should be:
onKeyDown(select, e) {
let action = this.get('onkeydown');
// if user passes `onkeydown` action
const result = action ? action(select, e) : undefined;
if (!action || result !== false) {
// if escape, then clear out selection
if (e.keyCode === 27) {
select.actions.choose(null);
}
}
return result;
}
This allow the onkeydown action result to bubble back up to ember-power-select itself.
The onkeydown action handler does not bubble up the keydown action result back up to the ember-power-select. So if the handler wanted to stop the event, EPS never sees the request to stop processing.
The code for onKeyDown method in component/ember-power-select-typeahead.js is:
It really should be:
This allow the onkeydown action result to bubble back up to ember-power-select itself.