Fix tests for Safari

Keyboard events do not always have path data when fired on unattached
elements in Safari.

Bug: issue 6509
Change-Id: Ic7ec579d6d6c806b0df305db4bc1ea8ad14ca6f1
This commit is contained in:
Wyatt Allen
2017-06-14 12:45:54 -07:00
parent 539987fa83
commit 9e93b50ff7

View File

@@ -42,10 +42,11 @@ limitations under the License.
shouldSuppressKeyboardShortcut(e) {
e = getKeyboardEvent(e);
if (e.path[0].tagName === 'INPUT' || e.path[0].tagName === 'TEXTAREA') {
const tagName = e.target.tagName;
if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
return true;
}
for (let i = 0; i < e.path.length; i++) {
for (let i = 0; e.path && i < e.path.length; i++) {
if (e.path[i].tagName === 'GR-OVERLAY') { return true; }
}
return false;