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

Change subject: Prevent parent window scroll in modal mode using overflow hidden
......................................................................


Prevent parent window scroll in modal mode using overflow hidden

This appears to be the least evil way to achieve this, as scroll
events are not cancelable.

Remove previous technique which only worked for keystrokes.

See http://stackoverflow.com/questions/1459676

Change-Id: Ib0d120676d54b92fdc6fd483088c24d45438feae
---
M src/WindowManager.js
1 file changed, 12 insertions(+), 7 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/WindowManager.js b/src/WindowManager.js
index 0a231b9..da7f718 100644
--- a/src/WindowManager.js
+++ b/src/WindowManager.js
@@ -184,10 +184,9 @@
  *
  * @param {jQuery.Event} e Mouse wheel event
  */
-OO.ui.WindowManager.prototype.onWindowMouseWheel = function ( e ) {
-       // Kill all events in the parent window if the child window is isolated,
-       // or if the event didn't come from the child window
-       return !( this.shouldIsolate() || !$.contains( 
this.getCurrentWindow().$frame[0], e.target ) );
+OO.ui.WindowManager.prototype.onWindowMouseWheel = function () {
+       // Kill all events in the parent window if the child window is isolated
+       return !this.shouldIsolate();
 };
 
 /**
@@ -205,9 +204,8 @@
                case OO.ui.Keys.UP:
                case OO.ui.Keys.RIGHT:
                case OO.ui.Keys.DOWN:
-                       // Kill all events in the parent window if the child 
window is isolated,
-                       // or if the event didn't come from the child window
-                       return !( this.shouldIsolate() || !$.contains( 
this.getCurrentWindow().$frame[0], e.target ) );
+                       // Kill all events in the parent window if the child 
window is isolated
+                       return !this.shouldIsolate();
        }
 };
 
@@ -637,6 +635,10 @@
                                // Start listening for top-level window 
dimension changes
                                'orientationchange resize': 
this.onWindowResizeHandler
                        } );
+                       // Disable window scrolling in isolated windows
+                       if ( !this.shouldIsolate() ) {
+                               $( this.getElementDocument().body ).css( 
'overflow', 'hidden' );
+                       }
                        this.globalEvents = true;
                }
        } else if ( this.globalEvents ) {
@@ -651,6 +653,9 @@
                        // Stop listening for top-level window dimension changes
                        'orientationchange resize': this.onWindowResizeHandler
                } );
+               if ( !this.shouldIsolate() ) {
+                       $( this.getElementDocument().body ).css( 'overflow', '' 
);
+               }
                this.globalEvents = false;
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0d120676d54b92fdc6fd483088c24d45438feae
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to