From 9623604aac457adf0e85fe7da86a698437c200ec Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 28 Sep 2016 14:38:59 -0400 Subject: [PATCH] (js) Don't allow hotkeys in md-chips --- UI/WebServerResources/js/Common/sgHotkeys.service.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UI/WebServerResources/js/Common/sgHotkeys.service.js b/UI/WebServerResources/js/Common/sgHotkeys.service.js index cfbbb2903..318a90b0b 100644 --- a/UI/WebServerResources/js/Common/sgHotkeys.service.js +++ b/UI/WebServerResources/js/Common/sgHotkeys.service.js @@ -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);