Retain focus on input when enter/tab with a value

This commit is contained in:
Bryan Housel
2016-04-30 00:11:27 -04:00
parent 5c68b2cc0f
commit 980bd23e8a
+14 -5
View File
@@ -175,6 +175,7 @@ iD.ui.preset.multiCombo = function(field, context) {
input.value('');
field.keys.push(field.key + val);
t[field.key + val] = 'yes';
window.setTimeout(function() { input.node().focus(); }, 10);
} else {
t[field.key] = val;
@@ -200,7 +201,7 @@ iD.ui.preset.multiCombo = function(field, context) {
.append('ul')
.attr('class', 'form-field-multicombo')
.on('click', function() {
window.setTimeout(function() { input.node().focus(); }, 100);
window.setTimeout(function() { input.node().focus(); }, 10);
});
} else {
@@ -218,10 +219,18 @@ iD.ui.preset.multiCombo = function(field, context) {
input
.on('change', change)
.on('blur', change)
.on('focus', function() {
if (isMulti) container.classed('active', true);
});
.on('blur', change);
if (isMulti) {
combobox
.on('accept', function() {
input.node().blur();
input.node().focus();
});
input
.on('focus', function() { container.classed('active', true); });
}
}