From c0d420eb4b282c180a3879352eb155938dae1b21 Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Fri, 18 Sep 2020 11:43:24 -0400 Subject: [PATCH] Fix keyboard navigation of the changeset upload raw tag list editor (re: #8004) --- modules/ui/commit.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/ui/commit.js b/modules/ui/commit.js index 01271385a..b4da581c4 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -388,6 +388,12 @@ export function uiCommit(context) { .on('click.save', function() { if (!d3_select(this).classed('disabled')) { this.blur(); // avoid keeping focus on the button - #4641 + + for (var key in context.changeset.tags) { + // remove any empty keys before upload + if (!key) delete context.changeset.tags[key]; + } + context.uploader().save(context.changeset); } }); @@ -547,14 +553,12 @@ export function uiCommit(context) { k = context.cleanTagKey(k); if (readOnlyTags.indexOf(k) !== -1) return; - if (k !== '' && v !== undefined) { - if (onInput) { - tags[k] = v; - } else { - tags[k] = context.cleanTagValue(v); - } - } else { + if (v === undefined) { delete tags[k]; + } else if (onInput) { + tags[k] = v; + } else { + tags[k] = context.cleanTagValue(v); } });