Focus into textbox when abandon issue modal opens
Previously, when you click on the "abandon change button", and the
pop-up opened, the cursor was not focused on the textarea. This change
fixes that.
Bug: Issue 4214
Change-Id: Ie01f009ef56884ca87723be0fc25669c96ee882d
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
index 8deab6b..f91816b 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
@@ -397,7 +397,11 @@
_showActionDialog: function(dialog) {
dialog.hidden = false;
- this.$.overlay.open();
+ this.$.overlay.open().then(function() {
+ if (dialog.resetFocus) {
+ dialog.resetFocus();
+ }
+ });
},
_handleResponse: function(action, response) {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog.js b/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog.js
index 0ce1cbb..e47f14f 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog.js
+++ b/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog.js
@@ -33,6 +33,10 @@
message: String,
},
+ resetFocus: function() {
+ this.$.messageInput.textarea.focus();
+ },
+
_handleConfirmTap: function(e) {
e.preventDefault();
this.fire('confirm', {reason: this.message}, {bubbles: false});