Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232575

Change subject: Make pressing Escape key in new topic title input also cancel
......................................................................

Make pressing Escape key in new topic title input also cancel

Bug: T101178
Change-Id: Idb023974a95efca66ec81691d2927d2f4806c00c
---
M modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/75/232575/1

diff --git a/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js 
b/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js
index adfa6b7..5d43d18 100644
--- a/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js
+++ b/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js
@@ -64,6 +64,7 @@
                        change: 'updateSaveButtonState'
                } );
                this.title.$element.on( 'focusin', this.onTitleFocusIn.bind( 
this ) );
+               this.title.$element.on( 'keydown', this.onTitleKeydown.bind( 
this ) );
 
                // Initialization
                this.updateSaveButtonState();
@@ -107,6 +108,18 @@
        };
 
        /**
+        * Respond to keydown events in title input, and cancel when escape is 
pressed.
+        * @param {jQuery.Event} e Keydown event
+        */
+       mw.flow.ui.NewTopicWidget.prototype.onTitleKeydown = function ( e ) {
+               if ( e.which === OO.ui.Keys.ESCAPE ) {
+                       this.onEditorCancel();
+                       e.preventDefault();
+                       e.stopPropagation();
+               }
+       };
+
+       /**
         * Respond to editor save event
         *
         * @param {string} content Content

-- 
To view, visit https://gerrit.wikimedia.org/r/232575
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb023974a95efca66ec81691d2927d2f4806c00c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to