Catrope has uploaded a new change for review.

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

Change subject: Dialog: Listen for Escape key on $element, not document
......................................................................

Dialog: Listen for Escape key on $element, not document

We don't need to listen on $document any more because we
don't have iframes any more. Listening on $element allows
e.stopPropagation() to actually work as intended.

Change-Id: I42c8ef08010d9785260559932106d41b7397d114
---
M src/Dialog.js
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/34/233834/1

diff --git a/src/Dialog.js b/src/Dialog.js
index 81facca..5294681 100644
--- a/src/Dialog.js
+++ b/src/Dialog.js
@@ -51,7 +51,7 @@
        this.actions = new OO.ui.ActionSet();
        this.attachedActions = [];
        this.currentAction = null;
-       this.onDocumentKeyDownHandler = this.onDocumentKeyDown.bind( this );
+       this.onDialogKeyDownHandler = this.onDialogKeyDown.bind( this );
 
        // Events
        this.actions.connect( this, {
@@ -134,7 +134,7 @@
  * @private
  * @param {jQuery.Event} e Key down event
  */
-OO.ui.Dialog.prototype.onDocumentKeyDown = function ( e ) {
+OO.ui.Dialog.prototype.onDialogKeyDown = function ( e ) {
        if ( e.which === OO.ui.Keys.ESCAPE ) {
                this.close();
                e.preventDefault();
@@ -231,7 +231,7 @@
                        this.actions.add( this.getActionWidgets( actions ) );
 
                        if ( this.constructor.static.escapable ) {
-                               this.$document.on( 'keydown', 
this.onDocumentKeyDownHandler );
+                               this.$element.on( 'keydown', 
this.onDialogKeyDownHandler );
                        }
                }, this );
 };
@@ -244,7 +244,7 @@
        return OO.ui.Dialog.parent.prototype.getTeardownProcess.call( this, 
data )
                .first( function () {
                        if ( this.constructor.static.escapable ) {
-                               this.$document.off( 'keydown', 
this.onDocumentKeyDownHandler );
+                               this.$element.off( 'keydown', 
this.onDialogKeyDownHandler );
                        }
 
                        this.actions.clear();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42c8ef08010d9785260559932106d41b7397d114
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
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