Ensure combobox menus are closed on blur (fixes #2207)

See 7c20bd3 for explanation.
This commit is contained in:
John Firebaugh
2014-05-28 17:37:07 -07:00
parent 38b821bdea
commit c30ba03606
5 changed files with 16 additions and 16 deletions
+4 -4
View File
@@ -124,10 +124,6 @@ iD.ui.preset.address = function(field, context) {
city = wrap.select('.addr-city');
postcode = wrap.select('.addr-postcode');
wrap.selectAll('input')
.on('blur', change)
.on('change', change);
street
.call(d3.combobox()
.fetcher(function(value, callback) {
@@ -145,6 +141,10 @@ iD.ui.preset.address = function(field, context) {
.fetcher(function(value, callback) {
callback(getPostCodes());
}));
wrap.selectAll('input')
.on('blur', change)
.on('change', change);
}
function change() {
+2 -2
View File
@@ -14,6 +14,7 @@ iD.ui.preset.typeCombo = function(field) {
.attr('id', 'preset-input-' + field.id);
input
.call(combobox)
.on('change', change)
.on('blur', change)
.each(function() {
@@ -26,8 +27,7 @@ iD.ui.preset.typeCombo = function(field) {
if (!err) options(_.pluck(data, 'value'));
});
}
})
.call(combobox);
});
function options(opts) {
combobox.data(opts.map(function(d) {
+4 -4
View File
@@ -15,10 +15,6 @@ iD.ui.preset.localized = function(field, context) {
.attr('class', 'localized-main')
.attr('placeholder', field.placeholder());
input
.on('blur', change)
.on('change', change);
if (field.id === 'name') {
var preset = context.presets().match(entity, context.graph());
input.call(d3.combobox().fetcher(
@@ -26,6 +22,10 @@ iD.ui.preset.localized = function(field, context) {
));
}
input
.on('blur', change)
.on('change', change);
var translateButton = selection.selectAll('.localized-add')
.data([0]);
+2 -2
View File
@@ -23,9 +23,9 @@ iD.ui.preset.maxspeed = function(field, context) {
.attr('placeholder', field.placeholder());
input
.call(combobox)
.on('change', change)
.on('blur', change)
.call(combobox);
.on('blur', change);
var childNodes = context.graph().childNodes(context.entity(entity.id)),
loc = childNodes[~~(childNodes.length/2)].loc;
+4 -4
View File
@@ -41,9 +41,9 @@ iD.ui.preset.wikipedia = function(field, context) {
.value('English');
lang
.call(langcombo)
.on('blur', changeLang)
.on('change', changeLang)
.call(langcombo);
.on('change', changeLang);
title = selection.selectAll('input.wiki-title')
.data([0]);
@@ -54,9 +54,9 @@ iD.ui.preset.wikipedia = function(field, context) {
.attr('id', 'preset-input-' + field.id);
title
.call(titlecombo)
.on('blur', change)
.on('change', change)
.call(titlecombo);
.on('change', change);
link = selection.selectAll('a.wiki-link')
.data([0]);