diff options
author | James D. Forrester <jforrester@wikimedia.org> | 2020-09-02 16:57:02 +0100 |
---|---|---|
committer | Jforrester <jforrester@wikimedia.org> | 2020-09-09 11:54:55 +0000 |
commit | 9cf6be92d86a1317366dc8d28e6f98e0c475bb21 (patch) | |
tree | 9ce9c5809fb9cc6e01612db7a3b2a1b8c4e7d595 /resources/lib/ooui/oojs-ui-widgets.js | |
parent | e41d377a479058e1eab05498ff64964a96b6dc1f (diff) | |
download | mediawikicore-9cf6be92d86a1317366dc8d28e6f98e0c475bb21.tar.gz mediawikicore-9cf6be92d86a1317366dc8d28e6f98e0c475bb21.zip |
Update OOUI to v0.40.3
Release notes:
https://gerrit.wikimedia.org/g/oojs/ui/+/v0.40.3/History.md
Bug: T245824
Bug: T249167
Bug: T258337
Bug: T258428
Bug: T259551
Bug: T259906
Bug: T259912
Bug: T260519
Bug: T261314
Change-Id: I16b1b650eb87699a5a88bdbd9b7568a8654e1e3c
Depends-On: I8e133892dbb239b2aeb152a762c8bf301c8fe7b9
Diffstat (limited to 'resources/lib/ooui/oojs-ui-widgets.js')
-rw-r--r-- | resources/lib/ooui/oojs-ui-widgets.js | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/resources/lib/ooui/oojs-ui-widgets.js b/resources/lib/ooui/oojs-ui-widgets.js index f18dbc3d6e7a..aec4bfda4edd 100644 --- a/resources/lib/ooui/oojs-ui-widgets.js +++ b/resources/lib/ooui/oojs-ui-widgets.js @@ -1,12 +1,12 @@ /*! - * OOUI v0.40.1 + * OOUI v0.40.3 * https://www.mediawiki.org/wiki/OOUI * * Copyright 2011–2020 OOUI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2020-08-05T21:21:44Z + * Date: 2020-09-02T15:42:49Z */ ( function ( OO ) { @@ -1402,11 +1402,17 @@ OO.mixinClass( OO.ui.StackLayout, OO.ui.mixin.GroupElement ); * @fires visibleItemChange */ OO.ui.StackLayout.prototype.onScroll = function () { - var currentRect, - len = this.items.length, - currentIndex = this.items.indexOf( this.currentItem ), - newIndex = currentIndex, - containerRect = this.$element[ 0 ].getBoundingClientRect(); + var currentRect, currentIndex, newIndex, containerRect, + len = this.items.length; + + if ( !this.currentItem ) { + // onScroll should never be triggered while there are no items, but this event is debounced. + return; + } + + currentIndex = this.items.indexOf( this.currentItem ); + newIndex = currentIndex; + containerRect = this.$element[ 0 ].getBoundingClientRect(); if ( !containerRect || ( !containerRect.top && !containerRect.bottom ) ) { // Can't get bounding rect, possibly not attached. @@ -3228,7 +3234,7 @@ OO.ui.ToggleSwitchWidget = function OoUiToggleSwitchWidget( config ) { this.$grip.addClass( 'oo-ui-toggleSwitchWidget-grip' ); this.$element .addClass( 'oo-ui-toggleSwitchWidget' ) - .attr( 'role', 'checkbox' ) + .attr( 'role', 'switch' ) .append( this.$glow, this.$grip ); }; @@ -4365,7 +4371,7 @@ OO.ui.TagItemWidget.prototype.isValid = function () { * additions. If 'tagLimit' is unset or is 0, an unlimited number of items can be * added. * @cfg {boolean} [allowReordering=true] Allow reordering of the items - * @cfg {Object[]|String[]} [selected] A set of selected tags. If given, + * @cfg {Object[]|string[]} [selected] A set of selected tags. If given, * these will appear in the tag list on initialization, as long as they * pass the validity tests. */ @@ -4584,21 +4590,22 @@ OO.ui.TagMultiselectWidget.prototype.onInputKeyPress = function ( e ) { OO.ui.TagMultiselectWidget.prototype.onInputKeyDown = function ( e ) { var movement, direction, widget = this, - withMetaKey = e.metaKey || e.ctrlKey, - isMovementInsideInput = function ( direction ) { - var inputRange = widget.input.getRange(), - inputValue = widget.hasInput && widget.input.getValue(); + withMetaKey = e.metaKey || e.ctrlKey; - if ( direction === 'forwards' && inputRange.to > inputValue.length - 1 ) { - return false; - } + function isMovementInsideInput( dir ) { + var inputRange = widget.input.getRange(), + inputValue = widget.hasInput && widget.input.getValue(); - if ( direction === 'backwards' && inputRange.from <= 0 ) { - return false; - } + if ( dir === 'forwards' && inputRange.to > inputValue.length - 1 ) { + return false; + } - return true; - }; + if ( dir === 'backwards' && inputRange.from <= 0 ) { + return false; + } + + return true; + } if ( !this.isDisabled() ) { // 'keypress' event is not triggered for Backspace key |