From: James D. Forrester Date: Thu, 21 Aug 2014 23:45:56 +0000 (-0700) Subject: Update OOjs UI to v0.1.0-pre (d6008381aa) X-Git-Tag: 1.31.0-rc.0~14332 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=8149789274c7eb07c365f783352357586efe1aff;p=lhc%2Fweb%2Fwiklou.git Update OOjs UI to v0.1.0-pre (d6008381aa) New changes: 7205b2a build: Check for files' existence before building using grunt-file-exists d600838 Make window managers destroyable Change-Id: I32e4f5bd41a5401b817cc6e37c6325df624a9e0e --- diff --git a/resources/lib/oojs-ui/oojs-ui-agora.css b/resources/lib/oojs-ui/oojs-ui-agora.css index 7291cddf88..c29b2629f8 100644 --- a/resources/lib/oojs-ui/oojs-ui-agora.css +++ b/resources/lib/oojs-ui/oojs-ui-agora.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (55b861b167) + * OOjs UI v0.1.0-pre (d6008381aa) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2014-08-21T16:59:20Z + * Date: 2014-08-21T23:45:56Z */ .oo-ui-dialog-content > .oo-ui-window-head, .oo-ui-dialog-content > .oo-ui-window-body, diff --git a/resources/lib/oojs-ui/oojs-ui-apex.css b/resources/lib/oojs-ui/oojs-ui-apex.css index 3f968c4e7e..a1c96ccd97 100644 --- a/resources/lib/oojs-ui/oojs-ui-apex.css +++ b/resources/lib/oojs-ui/oojs-ui-apex.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (55b861b167) + * OOjs UI v0.1.0-pre (d6008381aa) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2014-08-21T16:59:20Z + * Date: 2014-08-21T23:45:56Z */ .oo-ui-dialog-content > .oo-ui-window-head, .oo-ui-dialog-content > .oo-ui-window-body, diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js index a0811d4235..13f4282660 100644 --- a/resources/lib/oojs-ui/oojs-ui.js +++ b/resources/lib/oojs-ui/oojs-ui.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (55b861b167) + * OOjs UI v0.1.0-pre (d6008381aa) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2014-08-21T16:59:20Z + * Date: 2014-08-21T23:45:56Z */ ( function ( OO ) { @@ -2727,21 +2727,8 @@ OO.ui.WindowManager.prototype.openWindow = function ( win, data ) { // Ensure handlers get called after preparingToOpen is set this.preparingToOpen.done( function () { if ( manager.modal ) { - manager.$( manager.getElementDocument() ).on( { - // Prevent scrolling by keys in top-level window - keydown: manager.onDocumentKeyDownHandler - } ); - manager.$( manager.getElementWindow() ).on( { - // Prevent scrolling by wheel in top-level window - mousewheel: manager.onWindowMouseWheelHandler, - // Start listening for top-level window dimension changes - 'orientationchange resize': manager.onWindowResizeHandler - } ); - // Hide other content from screen readers - manager.$ariaHidden = $( 'body' ) - .children() - .not( manager.$element.parentsUntil( 'body' ).last() ) - .attr( 'aria-hidden', '' ); + manager.toggleGlobalEvents( true ); + manager.toggleAriaIsolation( true ); } manager.currentWindow = win; manager.opening = opening; @@ -2828,21 +2815,8 @@ OO.ui.WindowManager.prototype.closeWindow = function ( win, data ) { win.teardown( data ).then( function () { closing.notify( { state: 'teardown' } ); if ( manager.modal ) { - manager.$( manager.getElementDocument() ).off( { - // Allow scrolling by keys in top-level window - keydown: manager.onDocumentKeyDownHandler - } ); - manager.$( manager.getElementWindow() ).off( { - // Allow scrolling by wheel in top-level window - mousewheel: manager.onWindowMouseWheelHandler, - // Stop listening for top-level window dimension changes - 'orientationchange resize': manager.onWindowResizeHandler - } ); - } - // Restore screen reader visiblity - if ( manager.$ariaHidden ) { - manager.$ariaHidden.removeAttr( 'aria-hidden' ); - manager.$ariaHidden = null; + manager.toggleGlobalEvents( false ); + manager.toggleAriaIsolation( false ); } manager.closing = null; manager.currentWindow = null; @@ -2961,6 +2935,84 @@ OO.ui.WindowManager.prototype.updateWindowSize = function ( win ) { return this; }; +/** + * Bind or unbind global events for scrolling. + * + * @param {boolean} [on] Bind global events + * @chainable + */ +OO.ui.WindowManager.prototype.toggleGlobalEvents = function ( on ) { + on = on === undefined ? !!this.globalEvents : !!on; + + if ( on ) { + if ( !this.globalEvents ) { + this.$( this.getElementDocument() ).on( { + // Prevent scrolling by keys in top-level window + keydown: this.onDocumentKeyDownHandler + } ); + this.$( this.getElementWindow() ).on( { + // Prevent scrolling by wheel in top-level window + mousewheel: this.onWindowMouseWheelHandler, + // Start listening for top-level window dimension changes + 'orientationchange resize': this.onWindowResizeHandler + } ); + this.globalEvents = true; + } + } else if ( this.globalEvents ) { + // Unbind global events + this.$( this.getElementDocument() ).off( { + // Allow scrolling by keys in top-level window + keydown: this.onDocumentKeyDownHandler + } ); + this.$( this.getElementWindow() ).off( { + // Allow scrolling by wheel in top-level window + mousewheel: this.onWindowMouseWheelHandler, + // Stop listening for top-level window dimension changes + 'orientationchange resize': this.onWindowResizeHandler + } ); + this.globalEvents = false; + } + + return this; +}; + +/** + * Toggle screen reader visibility of content other than the window manager. + * + * @param {boolean} [isolate] Make only the window manager visible to screen readers + * @chainable + */ +OO.ui.WindowManager.prototype.toggleAriaIsolation = function ( isolate ) { + isolate = isolate === undefined ? !this.$ariaHidden : !!isolate; + + if ( isolate ) { + if ( !this.$ariaHidden ) { + // Hide everything other than the window manager from screen readers + this.$ariaHidden = $( 'body' ) + .children() + .not( this.$element.parentsUntil( 'body' ).last() ) + .attr( 'aria-hidden', '' ); + } + } else if ( this.$ariaHidden ) { + // Restore screen reader visiblity + this.$ariaHidden.removeAttr( 'aria-hidden' ); + this.$ariaHidden = null; + } + + return this; +}; + +/** + * Destroy window manager. + * + * Windows will not be closed, only removed from the DOM. + */ +OO.ui.WindowManager.prototype.destroy = function () { + this.toggleGlobalEvents( false ); + this.toggleAriaIsolation( false ); + this.$element.remove(); +}; + /** * @abstract * @class diff --git a/resources/lib/oojs-ui/oojs-ui.svg.css b/resources/lib/oojs-ui/oojs-ui.svg.css index f84ea0b112..17432f8fe1 100644 --- a/resources/lib/oojs-ui/oojs-ui.svg.css +++ b/resources/lib/oojs-ui/oojs-ui.svg.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (55b861b167) + * OOjs UI v0.1.0-pre (d6008381aa) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2014-08-21T16:59:20Z + * Date: 2014-08-21T23:45:56Z */ /* Textures */ .oo-ui-texture-pending {