X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=resources%2Flib%2Foojs-ui%2Foojs-ui-widgets.js;h=0ad54345e3bbaa4703fe44193c6db54f0437cb9e;hb=8e27780cfdb7209e22a2c8a05b4ca4774d8fdfa6;hp=b4c4655406994885bab7869c15123058d0ca2c09;hpb=059fdf444ebc254fe703d36c98397164b5dbd533;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/lib/oojs-ui/oojs-ui-widgets.js b/resources/lib/oojs-ui/oojs-ui-widgets.js index b4c4655406..0ad54345e3 100644 --- a/resources/lib/oojs-ui/oojs-ui-widgets.js +++ b/resources/lib/oojs-ui/oojs-ui-widgets.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.23.2 + * OOjs UI v0.24.1 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2017 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2017-09-26T20:18:42Z + * Date: 2017-10-31T22:46:35Z */ ( function ( OO ) { @@ -1883,12 +1883,21 @@ OO.ui.BookletLayout.prototype.onStackLayoutVisibleItemChange = function ( page ) * @param {OO.ui.PanelLayout|null} page The page panel that is now the current panel */ OO.ui.BookletLayout.prototype.onStackLayoutSet = function ( page ) { - var layout = this; - if ( !this.scrolling && page ) { - page.scrollElementIntoView().done( function () { - if ( layout.autoFocus && !OO.ui.isMobile() ) { - layout.focus(); - } + var promise, layout = this; + // If everything is unselected, do nothing + if ( !page ) { + return; + } + // For continuous BookletLayouts, scroll the selected page into view first + if ( this.stackLayout.continuous && !this.scrolling ) { + promise = page.scrollElementIntoView(); + } else { + promise = $.Deferred().resolve(); + } + // Focus the first element on the newly selected panel + if ( this.autoFocus && !OO.ui.isMobile() ) { + promise.done( function () { + layout.focus(); } ); } }; @@ -2415,13 +2424,13 @@ OO.ui.IndexLayout.prototype.onStackLayoutFocus = function ( e ) { * @param {OO.ui.PanelLayout|null} tabPanel The tab panel that is now the current panel */ OO.ui.IndexLayout.prototype.onStackLayoutSet = function ( tabPanel ) { - var layout = this; - if ( tabPanel ) { - tabPanel.scrollElementIntoView().done( function () { - if ( layout.autoFocus && !OO.ui.isMobile() ) { - layout.focus(); - } - } ); + // If everything is unselected, do nothing + if ( !tabPanel ) { + return; + } + // Focus the first element on the newly selected panel + if ( this.autoFocus && !OO.ui.isMobile() ) { + this.focus(); } };