(js) Don't allow hotkeys in md-chips

pull/222/head
Francis Lachapelle 2016-09-28 14:38:59 -04:00
parent 3d30345fb5
commit 9623604aac
1 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,11 @@
*/
this._preventIn = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'];
/**
* Keybindings are ignored by default when coming from special elements
*/
this._preventInClass = ['md-chip-content'];
this._onKeydown = this._onKeydown.bind(this);
this._onKeyup = this._onKeyup.bind(this);
this._onKeypress = this._onKeypress.bind(this);
@ -162,6 +167,7 @@
target = event.target || event.srcElement,
nodeName = target.nodeName.toUpperCase();
if (!_.includes(this._preventIn, nodeName) &&
_.intersection(target.classList, this._preventInClass).length === 0 &&
_.intersection(target.classList, hotkey.preventInClass).length === 0) {
try {
hotkey.callback.call(hotkey.context, event, hotkey.args);