From f534ca2e8a1a33251ee17229ec18a3b424e4429a Mon Sep 17 00:00:00 2001 From: Ben Rohlfs Date: Tue, 3 Dec 2019 08:49:24 +0100 Subject: [PATCH] Fix undefined branch in create-destination-dialog Follow-up of change 234145, where I think this dialog was just overlooked. As in all the other dialogs the bare confirm event from gr-dialog must be prevented from propagating, so that the new detailed event is the only one handled by parent elements. Otherwise two 'confirm' events would be handled, and the one from gr-dialog does not have the 'branch' detail, so it would become undefined in the dialog. Bug: Issue 12024 Change-Id: I8374e9dbd27ec69972011e3cfed58acb0f7052d4 --- .../gr-create-destination-dialog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog.js b/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog.js index 3652e70508..cbc7bcda81 100644 --- a/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog.js +++ b/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog.js @@ -50,9 +50,13 @@ this.$.createOverlay.close(); } - _pickerConfirm() { + _pickerConfirm(e) { this.$.createOverlay.close(); const detail = {repo: this._repo, branch: this._branch}; + // e is a 'confirm' event from gr-dialog. We want to fire a more detailed + // 'confirm' event here, so let's stop propagation of the bare event. + e.preventDefault(); + e.stopPropagation(); this.dispatchEvent(new CustomEvent('confirm', {detail, bubbles: false})); }