From a4db31f9a49d62d40270dbfc4402fdf5eebe73b1 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 2 Dec 2014 08:08:25 +0000 Subject: [PATCH] Prevent scrolling beneath modals on mobile devices by removing overflow from `#wpwrap` when a modal is open. Fixes #29909 Props avryl git-svn-id: https://develop.svn.wordpress.org/trunk@30707 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/common.css | 5 +++++ src/wp-includes/js/wplink.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index 3af3a6e616..6bc57e19f3 100644 --- a/src/wp-admin/css/common.css +++ b/src/wp-admin/css/common.css @@ -223,6 +223,11 @@ body.modal-open { overflow: hidden; } +body.mobile.modal-open #wpwrap { + overflow: hidden; + height: 100%; +} + iframe, img { border: 0; diff --git a/src/wp-includes/js/wplink.js b/src/wp-includes/js/wplink.js index 04012176e2..acb8ccc391 100644 --- a/src/wp-includes/js/wplink.js +++ b/src/wp-includes/js/wplink.js @@ -77,6 +77,8 @@ var wpLink; open: function( editorId ) { var ed; + $( document.body ).addClass( 'modal-open' ); + wpLink.range = null; if ( editorId ) { @@ -166,6 +168,8 @@ var wpLink; }, close: function() { + $( document.body ).removeClass( 'modal-open' ); + if ( ! wpLink.isMCE() ) { wpLink.textarea.focus();