Focus search after going back to preset grid (fixes #1386)

This commit is contained in:
John Firebaugh
2013-04-26 11:48:25 -07:00
parent 24ecf2a697
commit 0a293c3ae9
2 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -42,7 +42,7 @@ iD.ui.Inspector = function(context, entity) {
.classed('pane tag-pane', true);
var presetGrid = iD.ui.PresetGrid(context, entity)
.newFeature(newFeature)
.autofocus(newFeature)
.on('close', browse)
.on('choose', function(preset) {
var right = panewrap.style('right').indexOf('%') > 0 ? '0%' : '0px';
@@ -64,6 +64,7 @@ iD.ui.Inspector = function(context, entity) {
.transition()
.style('right', right);
presetGrid.autofocus(true);
presetLayer.call(presetGrid, preset);
});
+5 -5
View File
@@ -3,7 +3,7 @@ iD.ui.PresetGrid = function(context, entity) {
defaultLimit = 9,
currentlyDrawn = 9,
presets,
newFeature = false;
autofocus = false;
function presetgrid(selection, preset) {
@@ -103,7 +103,7 @@ iD.ui.PresetGrid = function(context, entity) {
searchwrap.append('span')
.attr('class', 'icon search');
if (newFeature) {
if (autofocus) {
search.node().focus();
}
@@ -246,9 +246,9 @@ iD.ui.PresetGrid = function(context, entity) {
}
}
presetgrid.newFeature = function(_) {
if (!arguments.length) return newFeature;
newFeature = _;
presetgrid.autofocus = function(_) {
if (!arguments.length) return autofocus;
autofocus = _;
return presetgrid;
};