Don't leave edit mode on pressing enter if a combobox is active

This commit is contained in:
Bryan Housel
2016-04-29 22:25:06 -04:00
parent 4b768057a5
commit ab3340e816
2 changed files with 3 additions and 1 deletions

View File

@@ -159,7 +159,8 @@ iD.ui.preset = function(context) {
.call(field.input)
.selectAll('input')
.on('keydown', function() {
if (d3.event.keyCode === 13) { // enter
// if user presses enter, and combobox is not active, accept edits..
if (d3.event.keyCode === 13 && d3.select('.combobox').empty()) {
context.enter(iD.modes.Browse(context));
}
})

View File

@@ -154,6 +154,7 @@ d3.combobox = function() {
}
function nav(dir) {
if (!suggestions.length) return;
idx = Math.max(Math.min(idx + dir, suggestions.length - 1), 0);
input.property('value', suggestions[idx].value);
render();