Simon Hunt
Committed by Gerrit Code Review

ONOS-4745: Fixed device rename Enter/Esc bug.

 - also, a couple of simplifications.

Change-Id: I11f878a5f4aa42668519cb26cc882aea296f4ac9
......@@ -98,19 +98,27 @@
}
}
var textFieldDoesNotBlock = {
enter: 1,
esc: 1
};
function textFieldInput() {
var t = d3.event.target.tagName.toLowerCase();
return t === 'input' || t === 'textarea';
}
function keyIn() {
if (textFieldInput()) {
return;
}
var event = d3.event,
keyCode = event.keyCode,
key = whatKey(keyCode),
kh = keyHandler,
textBlockable = !textFieldDoesNotBlock[key];
if (textBlockable && textFieldInput()) {
return;
}
var kh = keyHandler,
gk = kh.globalKeys[key],
gcb = fs.isF(gk) || (fs.isA(gk) && fs.isF(gk[0])),
dk = kh.dialogKeys[key],
......@@ -120,7 +128,7 @@
vcb = fs.isF(vk) || (fs.isA(vk) && fs.isF(vk[0])) || fs.isF(kh.viewFn),
token = 'keyev'; // indicate this was a key-pressed event
d3.event.stopPropagation();
event.stopPropagation();
if (enabled) {
if (matchSeq(key)) return;
......@@ -159,9 +167,9 @@
// Masked keys are global key handlers that always return true.
// That is, the view will never see the event for that key.
maskedKeys: {
slash: true,
backSlash: true,
T: true
slash: 1,
backSlash: 1,
T: 1
}
});
}
......