Ensure combobox suggestion menu is closed on blur

The combobox's blur handler needs to be called prior
to the tag editor's blur handler. The latter can cause
a re-render, which will rebind handlers. Rebound handlers
are not called during the same event dispatch cycle, so
when the combobox blur handler is last, it sometimes
doesn't get called, stranding the menu.
This commit is contained in:
John Firebaugh
2013-05-28 13:07:27 -07:00
parent 5600b6271d
commit 7c20bd3722

View File

@@ -86,24 +86,6 @@ iD.ui.RawTagEditor = function(context) {
$items.order();
$items.select('input.key')
.property('value', function(d) {
return d.key;
})
.on('blur', keyChange)
.on('change', keyChange);
$items.select('input.value')
.property('value', function(d) {
return d.value;
})
.on('blur', valueChange)
.on('change', valueChange)
.on('keydown.push-more', pushMore);
$items.select('button.remove')
.on('click', removeTag);
$items.each(function(tag) {
d3.select(this)
.each(bindTypeahead)
@@ -111,6 +93,20 @@ iD.ui.RawTagEditor = function(context) {
.call(tag.reference.body);
});
$items.select('input.key')
.property('value', function(d) { return d.key; })
.on('blur', keyChange)
.on('change', keyChange);
$items.select('input.value')
.property('value', function(d) { return d.value; })
.on('blur', valueChange)
.on('change', valueChange)
.on('keydown.push-more', pushMore);
$items.select('button.remove')
.on('click', removeTag);
$items.exit()
.remove();