Committed by
Gerrit Code Review
ONOS-4745: Fixed device rename Enter/Esc bug.
- also, a couple of simplifications. Change-Id: I11f878a5f4aa42668519cb26cc882aea296f4ac9
Showing
1 changed file
with
16 additions
and
8 deletions
... | @@ -98,19 +98,27 @@ | ... | @@ -98,19 +98,27 @@ |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | + var textFieldDoesNotBlock = { | ||
102 | + enter: 1, | ||
103 | + esc: 1 | ||
104 | + }; | ||
105 | + | ||
101 | function textFieldInput() { | 106 | function textFieldInput() { |
102 | var t = d3.event.target.tagName.toLowerCase(); | 107 | var t = d3.event.target.tagName.toLowerCase(); |
103 | return t === 'input' || t === 'textarea'; | 108 | return t === 'input' || t === 'textarea'; |
104 | } | 109 | } |
105 | 110 | ||
106 | function keyIn() { | 111 | function keyIn() { |
107 | - if (textFieldInput()) { | ||
108 | - return; | ||
109 | - } | ||
110 | var event = d3.event, | 112 | var event = d3.event, |
111 | keyCode = event.keyCode, | 113 | keyCode = event.keyCode, |
112 | key = whatKey(keyCode), | 114 | key = whatKey(keyCode), |
113 | - kh = keyHandler, | 115 | + textBlockable = !textFieldDoesNotBlock[key]; |
116 | + | ||
117 | + if (textBlockable && textFieldInput()) { | ||
118 | + return; | ||
119 | + } | ||
120 | + | ||
121 | + var kh = keyHandler, | ||
114 | gk = kh.globalKeys[key], | 122 | gk = kh.globalKeys[key], |
115 | gcb = fs.isF(gk) || (fs.isA(gk) && fs.isF(gk[0])), | 123 | gcb = fs.isF(gk) || (fs.isA(gk) && fs.isF(gk[0])), |
116 | dk = kh.dialogKeys[key], | 124 | dk = kh.dialogKeys[key], |
... | @@ -120,7 +128,7 @@ | ... | @@ -120,7 +128,7 @@ |
120 | vcb = fs.isF(vk) || (fs.isA(vk) && fs.isF(vk[0])) || fs.isF(kh.viewFn), | 128 | vcb = fs.isF(vk) || (fs.isA(vk) && fs.isF(vk[0])) || fs.isF(kh.viewFn), |
121 | token = 'keyev'; // indicate this was a key-pressed event | 129 | token = 'keyev'; // indicate this was a key-pressed event |
122 | 130 | ||
123 | - d3.event.stopPropagation(); | 131 | + event.stopPropagation(); |
124 | 132 | ||
125 | if (enabled) { | 133 | if (enabled) { |
126 | if (matchSeq(key)) return; | 134 | if (matchSeq(key)) return; |
... | @@ -159,9 +167,9 @@ | ... | @@ -159,9 +167,9 @@ |
159 | // Masked keys are global key handlers that always return true. | 167 | // Masked keys are global key handlers that always return true. |
160 | // That is, the view will never see the event for that key. | 168 | // That is, the view will never see the event for that key. |
161 | maskedKeys: { | 169 | maskedKeys: { |
162 | - slash: true, | 170 | + slash: 1, |
163 | - backSlash: true, | 171 | + backSlash: 1, |
164 | - T: true | 172 | + T: 1 |
165 | } | 173 | } |
166 | }); | 174 | }); |
167 | } | 175 | } | ... | ... |
-
Please register or login to post a comment