From e0dc20ff5839548cd33776d0a0a2f7730cb9af6f Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 26 Mar 2013 12:31:55 -0400 Subject: [PATCH] Revert and inspector buttons should not focus the form. Fixes #1139 --- js/id/ui/preset.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/id/ui/preset.js b/js/id/ui/preset.js index 2afb1c1f8..308005835 100644 --- a/js/id/ui/preset.js +++ b/js/id/ui/preset.js @@ -68,6 +68,8 @@ iD.ui.preset = function(context, entity, preset) { } function revert(field) { + d3.event.stopPropagation(); + d3.event.preventDefault(); var t = {}; field.keys.forEach(function(key) { t[key] = original ? original.tags[key] : undefined; @@ -76,6 +78,8 @@ iD.ui.preset = function(context, entity, preset) { } function toggleReference(field) { + d3.event.stopPropagation(); + d3.event.preventDefault(); _.forEach(fields, function(other) { if (other.id === field.id) { other.showingReference = !other.showingReference; @@ -113,8 +117,6 @@ iD.ui.preset = function(context, entity, preset) { .attr('for', function(field) { return 'preset-input-' + field.id; }) .text(function(field) { return field.label(); }); - - label.append('button') .attr('class', 'tag-reference-button fr') .attr('tabindex', -1) @@ -157,14 +159,14 @@ iD.ui.preset = function(context, entity, preset) { .style('padding-top', '20px') .style('max-height', '200px') .style('opacity', '1'); - } else { + } else { d3.select(this) .call(iD.ui.TagReference(entity, {key: field.key})) .transition() .duration(200) .style('max-height', '0px') .style('padding-top', '0px') - .style('opacity', '0'); + .style('opacity', '0'); } });