jenkins-bot has submitted this change and it was merged.

Change subject: Close language settings when clicked outside
......................................................................


Close language settings when clicked outside

To make the behavior consistent with ULS langauge selection window.

This also avoid multiple language settings screen appearing in rare
case of using two entry points to access language settings one after
another.

Bug: 50559
Change-Id: I990eb6402085290df314db0a75235e0ad7b2fd55
---
M resources/js/ext.uls.languagesettings.js
1 file changed, 14 insertions(+), 2 deletions(-)

Approvals:
  Amire80: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/js/ext.uls.languagesettings.js 
b/resources/js/ext.uls.languagesettings.js
index 72ea0ff..8ef3d49 100644
--- a/resources/js/ext.uls.languagesettings.js
+++ b/resources/js/ext.uls.languagesettings.js
@@ -67,6 +67,14 @@
                        this.$element.on( 'click', $.proxy( this.click, this ) 
);
                        this.$window.find( '#languagesettings-close' )
                                .on( 'click', $.proxy( this.close, this ) );
+
+                       // Hide the window when clicked outside
+                       $( 'html' ).click( $.proxy( this.close, this ) );
+
+                       // ... but when clicked on window do not hide.
+                       this.$window.on( 'click', function () {
+                               return false;
+                       } );
                },
 
                render: function () {
@@ -155,7 +163,8 @@
                                this.render();
                                this.initialized = true;
                        }
-
+                       // close model windows close, if they hide on page click
+                       $( 'html' ).click();
                        this.$window.i18n();
                        this.shown = true;
                        this.$window.show();
@@ -202,7 +211,10 @@
                        }
                },
 
-               click: function () {
+               click: function ( e ) {
+                       e.stopPropagation();
+                       e.preventDefault();
+
                        if ( this.shown ) {
                                this.hide();
                        } else {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I990eb6402085290df314db0a75235e0ad7b2fd55
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Pginer <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to