' );
// Events
- this.dismissButton.connect( this, { 'click': 'onDismissErrorButtonClick' } );
- this.retryButton.connect( this, { 'click': 'onRetryButtonClick' } );
+ this.dismissButton.connect( this, { click: 'onDismissErrorButtonClick' } );
+ this.retryButton.connect( this, { click: 'onRetryButtonClick' } );
// Initialization
this.title.$element.addClass( 'oo-ui-processDialog-title' );
@@ -5455,7 +5461,7 @@ OO.ui.ProcessDialog.prototype.attachActions = function () {
others = this.actions.getOthers();
if ( special.primary ) {
this.$primaryActions.append( special.primary.$element );
- special.primary.toggleFramed( false );
+ special.primary.toggleFramed( true );
}
if ( others.length ) {
for ( i = 0, len = others.length; i < len; i++ ) {
@@ -5466,7 +5472,7 @@ OO.ui.ProcessDialog.prototype.attachActions = function () {
}
if ( special.safe ) {
this.$safeActions.append( special.safe.$element );
- special.safe.toggleFramed( false );
+ special.safe.toggleFramed( true );
}
this.fitLabel();
@@ -5491,7 +5497,7 @@ OO.ui.ProcessDialog.prototype.fitLabel = function () {
this.$safeActions.is( ':visible' ) ? this.$safeActions.width() : 0,
this.$primaryActions.is( ':visible' ) ? this.$primaryActions.width() : 0
);
- this.$location.css( { 'padding-left': width, 'padding-right': width } );
+ this.$location.css( { paddingLeft: width, paddingRight: width } );
return this;
};
@@ -5559,31 +5565,31 @@ OO.ui.BookletLayout = function OoUiBookletLayout( config ) {
this.currentPageName = null;
this.pages = {};
this.ignoreFocus = false;
- this.stackLayout = new OO.ui.StackLayout( { '$': this.$, 'continuous': !!config.continuous } );
+ this.stackLayout = new OO.ui.StackLayout( { $: this.$, continuous: !!config.continuous } );
this.autoFocus = config.autoFocus === undefined || !!config.autoFocus;
this.outlineVisible = false;
this.outlined = !!config.outlined;
if ( this.outlined ) {
this.editable = !!config.editable;
this.outlineControlsWidget = null;
- this.outlineWidget = new OO.ui.OutlineWidget( { '$': this.$ } );
- this.outlinePanel = new OO.ui.PanelLayout( { '$': this.$, 'scrollable': true } );
+ this.outlineWidget = new OO.ui.OutlineWidget( { $: this.$ } );
+ this.outlinePanel = new OO.ui.PanelLayout( { $: this.$, scrollable: true } );
this.gridLayout = new OO.ui.GridLayout(
[ this.outlinePanel, this.stackLayout ],
- { '$': this.$, 'widths': [ 1, 2 ] }
+ { $: this.$, widths: [ 1, 2 ] }
);
this.outlineVisible = true;
if ( this.editable ) {
this.outlineControlsWidget = new OO.ui.OutlineControlsWidget(
- this.outlineWidget, { '$': this.$ }
+ this.outlineWidget, { $: this.$ }
);
}
}
// Events
- this.stackLayout.connect( this, { 'set': 'onStackLayoutSet' } );
+ this.stackLayout.connect( this, { set: 'onStackLayoutSet' } );
if ( this.outlined ) {
- this.outlineWidget.connect( this, { 'select': 'onOutlineWidgetSelect' } );
+ this.outlineWidget.connect( this, { select: 'onOutlineWidgetSelect' } );
}
if ( this.autoFocus ) {
// Event 'focus' does not bubble, but 'focusin' does
@@ -5657,13 +5663,16 @@ OO.ui.BookletLayout.prototype.onStackLayoutFocus = function ( e ) {
* @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;
+ var $input, layout = this;
if ( page ) {
- page.scrollElementIntoView( { 'complete': function () {
+ page.scrollElementIntoView( { complete: function () {
if ( layout.autoFocus ) {
// Set focus to the first input if nothing on the page is focused yet
if ( !page.$element.find( ':focus' ).length ) {
- page.$element.find( ':input:first' ).focus();
+ $input = page.$element.find( ':input:first' );
+ if ( $input.length ) {
+ $input[0].focus();
+ }
}
}
} } );
@@ -5836,7 +5845,7 @@ OO.ui.BookletLayout.prototype.addPages = function ( pages, index ) {
name = page.getName();
this.pages[page.getName()] = page;
if ( this.outlined ) {
- item = new OO.ui.OutlineItemWidget( name, page, { '$': this.$ } );
+ item = new OO.ui.OutlineItemWidget( name, page, { $: this.$ } );
page.setOutlineItem( item );
items.push( item );
}
@@ -5914,6 +5923,7 @@ OO.ui.BookletLayout.prototype.clearPages = function () {
*/
OO.ui.BookletLayout.prototype.setPage = function ( name ) {
var selectedItem,
+ $focused,
page = this.pages[name];
if ( name !== this.currentPageName ) {
@@ -5930,7 +5940,10 @@ OO.ui.BookletLayout.prototype.setPage = function ( name ) {
// is not needed if the next page has something focusable because once it is focused
// this blur happens automatically
if ( this.autoFocus && !page.$element.find( ':input' ).length ) {
- this.pages[this.currentPageName].$element.find( ':focus' ).blur();
+ $focused = this.pages[this.currentPageName].$element.find( ':focus' );
+ if ( $focused.length ) {
+ $focused[0].blur();
+ }
}
}
this.currentPageName = name;
@@ -5963,13 +5976,13 @@ OO.ui.BookletLayout.prototype.updateOutlineWidget = function () {
* @mixins OO.ui.LabeledElement
*
* Available label alignment modes include:
- * - 'left': Label is before the field and aligned away from it, best for when the user will be
+ * - left: Label is before the field and aligned away from it, best for when the user will be
* scanning for a specific label in a form with many fields
- * - 'right': Label is before the field and aligned toward it, best for forms the user is very
+ * - right: Label is before the field and aligned toward it, best for forms the user is very
* familiar with and will tab through field checking quickly to verify which field they are in
- * - 'top': Label is before the field and above it, best for when the use will need to fill out all
+ * - top: Label is before the field and above it, best for when the use will need to fill out all
* fields from top to bottom in a form with few fields
- * - 'inline': Label is after the field and aligned toward it, best for small boolean fields like
+ * - inline: Label is after the field and aligned toward it, best for small boolean fields like
* checkboxes or radio buttons
*
* @constructor
@@ -5981,7 +5994,7 @@ OO.ui.BookletLayout.prototype.updateOutlineWidget = function () {
OO.ui.FieldLayout = function OoUiFieldLayout( field, config ) {
var popupButtonWidget;
// Config initialization
- config = $.extend( { 'align': 'left' }, config );
+ config = $.extend( { align: 'left' }, config );
// Parent constructor
OO.ui.FieldLayout.super.call( this, config );
@@ -5992,10 +6005,10 @@ OO.ui.FieldLayout = function OoUiFieldLayout( field, config ) {
if ( config.help ) {
popupButtonWidget = new OO.ui.PopupButtonWidget( $.extend(
{
- '$': this.$,
- 'frameless': true,
- 'icon': 'info',
- 'title': config.help
+ $: this.$,
+ frameless: true,
+ icon: 'info',
+ title: config.help
},
config,
{ label: null }
@@ -6013,7 +6026,7 @@ OO.ui.FieldLayout = function OoUiFieldLayout( field, config ) {
if ( this.field instanceof OO.ui.InputWidget ) {
this.$label.on( 'click', OO.ui.bind( this.onLabelClick, this ) );
}
- this.field.connect( this, { 'disable': 'onFieldDisable' } );
+ this.field.connect( this, { disable: 'onFieldDisable' } );
// Initialization
this.$element.addClass( 'oo-ui-fieldLayout' );
@@ -6313,11 +6326,11 @@ OO.ui.GridLayout.prototype.update = function () {
panel = this.panels[i];
width = this.widths[x];
dimensions = {
- 'width': Math.round( width * 100 ) + '%',
- 'height': Math.round( height * 100 ) + '%',
- 'top': Math.round( top * 100 ) + '%',
+ width: Math.round( width * 100 ) + '%',
+ height: Math.round( height * 100 ) + '%',
+ top: Math.round( top * 100 ) + '%',
// HACK: Work around IE bug by setting visibility: hidden; if width or height is zero
- 'visibility': width === 0 || height === 0 ? 'hidden' : ''
+ visibility: width === 0 || height === 0 ? 'hidden' : ''
};
// If RTL, reverse:
if ( OO.ui.Element.getDir( this.$.context ) === 'rtl' ) {
@@ -6400,7 +6413,7 @@ OO.inheritClass( OO.ui.PanelLayout, OO.ui.Layout );
*/
OO.ui.PageLayout = function OoUiPageLayout( name, config ) {
// Configuration initialization
- config = $.extend( { 'scrollable': true }, config );
+ config = $.extend( { scrollable: true }, config );
// Parent constructor
OO.ui.PageLayout.super.call( this, config );
@@ -6516,7 +6529,7 @@ OO.ui.PageLayout.prototype.setActive = function ( active ) {
*/
OO.ui.StackLayout = function OoUiStackLayout( config ) {
// Config initialization
- config = $.extend( { 'scrollable': true }, config );
+ config = $.extend( { scrollable: true }, config );
// Parent constructor
OO.ui.StackLayout.super.call( this, config );
@@ -6611,7 +6624,7 @@ OO.ui.StackLayout.prototype.removeItems = function ( items ) {
// Mixin method
OO.ui.GroupElement.prototype.removeItems.call( this, items );
- if ( $.inArray( this.currentItem, items ) !== -1 ) {
+ if ( $.inArray( this.currentItem, items ) !== -1 ) {
if ( this.items.length ) {
this.setItem( this.items[0] );
} else {
@@ -6741,8 +6754,8 @@ OO.ui.PopupToolGroup = function OoUiPopupToolGroup( toolbar, config ) {
// Events
this.$handle.on( {
- 'mousedown': OO.ui.bind( this.onHandleMouseDown, this ),
- 'mouseup': OO.ui.bind( this.onHandleMouseUp, this )
+ 'mousedown touchstart': OO.ui.bind( this.onHandlePointerDown, this ),
+ 'mouseup touchend': OO.ui.bind( this.onHandlePointerUp, this )
} );
// Initialization
@@ -6806,11 +6819,12 @@ OO.ui.PopupToolGroup.prototype.onBlur = function ( e ) {
/**
* @inheritdoc
*/
-OO.ui.PopupToolGroup.prototype.onMouseUp = function ( e ) {
- if ( !this.isDisabled() && e.which === 1 ) {
+OO.ui.PopupToolGroup.prototype.onPointerUp = function ( e ) {
+ // e.which is 0 for touch events, 1 for left mouse button
+ if ( !this.isDisabled() && e.which <= 1 ) {
this.setActive( false );
}
- return OO.ui.PopupToolGroup.super.prototype.onMouseUp.call( this, e );
+ return OO.ui.PopupToolGroup.super.prototype.onPointerUp.call( this, e );
};
/**
@@ -6818,7 +6832,7 @@ OO.ui.PopupToolGroup.prototype.onMouseUp = function ( e ) {
*
* @param {jQuery.Event} e Mouse up event
*/
-OO.ui.PopupToolGroup.prototype.onHandleMouseUp = function () {
+OO.ui.PopupToolGroup.prototype.onHandlePointerUp = function () {
return false;
};
@@ -6827,8 +6841,9 @@ OO.ui.PopupToolGroup.prototype.onHandleMouseUp = function () {
*
* @param {jQuery.Event} e Mouse down event
*/
-OO.ui.PopupToolGroup.prototype.onHandleMouseDown = function ( e ) {
- if ( !this.isDisabled() && e.which === 1 ) {
+OO.ui.PopupToolGroup.prototype.onHandlePointerDown = function ( e ) {
+ // e.which is 0 for touch events, 1 for left mouse button
+ if ( !this.isDisabled() && e.which <= 1 ) {
this.setActive( !this.active );
}
return false;
@@ -6901,7 +6916,7 @@ OO.ui.MenuToolGroup = function OoUiMenuToolGroup( toolbar, config ) {
OO.ui.MenuToolGroup.super.call( this, toolbar, config );
// Events
- this.toolbar.connect( this, { 'updateState': 'onUpdateState' } );
+ this.toolbar.connect( this, { updateState: 'onUpdateState' } );
// Initialization
this.$element.addClass( 'oo-ui-menuToolGroup' );
@@ -7110,9 +7125,9 @@ OO.ui.LookupInputWidget = function OoUiLookupInputWidget( input, config ) {
this.lookupInput = input;
this.$overlay = config.$overlay || this.$( 'body,.oo-ui-window-overlay' ).last();
this.lookupMenu = new OO.ui.TextInputMenuWidget( this, {
- '$': OO.ui.Element.getJQuery( this.$overlay ),
- 'input': this.lookupInput,
- '$container': config.$container
+ $: OO.ui.Element.getJQuery( this.$overlay ),
+ input: this.lookupInput,
+ $container: config.$container
} );
this.lookupCache = {};
this.lookupQuery = null;
@@ -7123,11 +7138,11 @@ OO.ui.LookupInputWidget = function OoUiLookupInputWidget( input, config ) {
this.$overlay.append( this.lookupMenu.$element );
this.lookupInput.$input.on( {
- 'focus': OO.ui.bind( this.onLookupInputFocus, this ),
- 'blur': OO.ui.bind( this.onLookupInputBlur, this ),
- 'mousedown': OO.ui.bind( this.onLookupInputMouseDown, this )
+ focus: OO.ui.bind( this.onLookupInputFocus, this ),
+ blur: OO.ui.bind( this.onLookupInputBlur, this ),
+ mousedown: OO.ui.bind( this.onLookupInputMouseDown, this )
} );
- this.lookupInput.connect( this, { 'change': 'onLookupInputChange' } );
+ this.lookupInput.connect( this, { change: 'onLookupInputChange' } );
// Initialization
this.$element.addClass( 'oo-ui-lookupWidget' );
@@ -7341,7 +7356,7 @@ OO.ui.LookupInputWidget.prototype.getLookupMenuItemsFromData = function () {
*/
OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, config ) {
// Configuration initialization
- config = $.extend( { 'icon': 'add-item' }, config );
+ config = $.extend( { icon: 'add-item' }, config );
// Parent constructor
OO.ui.OutlineControlsWidget.super.call( this, config );
@@ -7354,33 +7369,33 @@ OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, confi
this.outline = outline;
this.$movers = this.$( '
' );
this.upButton = new OO.ui.ButtonWidget( {
- '$': this.$,
- 'framed': false,
- 'icon': 'collapse',
- 'title': OO.ui.msg( 'ooui-outline-control-move-up' )
+ $: this.$,
+ framed: false,
+ icon: 'collapse',
+ title: OO.ui.msg( 'ooui-outline-control-move-up' )
} );
this.downButton = new OO.ui.ButtonWidget( {
- '$': this.$,
- 'framed': false,
- 'icon': 'expand',
- 'title': OO.ui.msg( 'ooui-outline-control-move-down' )
+ $: this.$,
+ framed: false,
+ icon: 'expand',
+ title: OO.ui.msg( 'ooui-outline-control-move-down' )
} );
this.removeButton = new OO.ui.ButtonWidget( {
- '$': this.$,
- 'framed': false,
- 'icon': 'remove',
- 'title': OO.ui.msg( 'ooui-outline-control-remove' )
+ $: this.$,
+ framed: false,
+ icon: 'remove',
+ title: OO.ui.msg( 'ooui-outline-control-remove' )
} );
// Events
outline.connect( this, {
- 'select': 'onOutlineChange',
- 'add': 'onOutlineChange',
- 'remove': 'onOutlineChange'
+ select: 'onOutlineChange',
+ add: 'onOutlineChange',
+ remove: 'onOutlineChange'
} );
- this.upButton.connect( this, { 'click': [ 'emit', 'move', -1 ] } );
- this.downButton.connect( this, { 'click': [ 'emit', 'move', 1 ] } );
- this.removeButton.connect( this, { 'click': [ 'emit', 'remove' ] } );
+ this.upButton.connect( this, { click: [ 'emit', 'move', -1 ] } );
+ this.downButton.connect( this, { click: [ 'emit', 'move', 1 ] } );
+ this.removeButton.connect( this, { click: [ 'emit', 'remove' ] } );
// Initialization
this.$element.addClass( 'oo-ui-outlineControlsWidget' );
@@ -7551,7 +7566,7 @@ OO.mixinClass( OO.ui.ButtonGroupWidget, OO.ui.GroupElement );
*/
OO.ui.ButtonWidget = function OoUiButtonWidget( config ) {
// Configuration initialization
- config = $.extend( { 'target': '_blank' }, config );
+ config = $.extend( { target: '_blank' }, config );
// Parent constructor
OO.ui.ButtonWidget.super.call( this, config );
@@ -7571,8 +7586,8 @@ OO.ui.ButtonWidget = function OoUiButtonWidget( config ) {
// Events
this.$button.on( {
- 'click': OO.ui.bind( this.onClick, this ),
- 'keypress': OO.ui.bind( this.onKeyPress, this )
+ click: OO.ui.bind( this.onClick, this ),
+ keypress: OO.ui.bind( this.onKeyPress, this )
} );
// Initialization
@@ -7707,7 +7722,7 @@ OO.ui.ButtonWidget.prototype.setTarget = function ( target ) {
*/
OO.ui.ActionWidget = function OoUiActionWidget( config ) {
// Config intialization
- config = $.extend( { 'framed': false }, config );
+ config = $.extend( { framed: false }, config );
// Parent constructor
OO.ui.ActionWidget.super.call( this, config );
@@ -8045,7 +8060,7 @@ OO.ui.IndicatorWidget.static.tagName = 'span';
*/
OO.ui.InlineMenuWidget = function OoUiInlineMenuWidget( config ) {
// Configuration initialization
- config = $.extend( { 'indicator': 'down' }, config );
+ config = $.extend( { indicator: 'down' }, config );
// Parent constructor
OO.ui.InlineMenuWidget.super.call( this, config );
@@ -8057,12 +8072,12 @@ OO.ui.InlineMenuWidget = function OoUiInlineMenuWidget( config ) {
OO.ui.TitledElement.call( this, this.$label, config );
// Properties
- this.menu = new OO.ui.MenuWidget( $.extend( { '$': this.$, 'widget': this }, config.menu ) );
+ this.menu = new OO.ui.MenuWidget( $.extend( { $: this.$, widget: this }, config.menu ) );
this.$handle = this.$( '
' );
// Events
- this.$element.on( { 'click': OO.ui.bind( this.onClick, this ) } );
- this.menu.connect( this, { 'select': 'onMenuSelect' } );
+ this.$element.on( { click: OO.ui.bind( this.onClick, this ) } );
+ this.menu.connect( this, { select: 'onMenuSelect' } );
// Initialization
this.$handle
@@ -8151,7 +8166,7 @@ OO.ui.InlineMenuWidget.prototype.onClick = function ( e ) {
*/
OO.ui.InputWidget = function OoUiInputWidget( config ) {
// Config intialization
- config = $.extend( { 'readOnly': false }, config );
+ config = $.extend( { readOnly: false }, config );
// Parent constructor
OO.ui.InputWidget.super.call( this, config );
@@ -8283,7 +8298,7 @@ OO.ui.InputWidget.prototype.simulateLabelClick = function () {
if ( this.$input.is( ':checkbox,:radio' ) ) {
this.$input.click();
} else if ( this.$input.is( ':input' ) ) {
- this.$input.focus();
+ this.$input[0].focus();
}
}
};
@@ -8328,7 +8343,7 @@ OO.ui.InputWidget.prototype.setDisabled = function ( state ) {
* @chainable
*/
OO.ui.InputWidget.prototype.focus = function () {
- this.$input.focus();
+ this.$input[0].focus();
return this;
};
@@ -8338,7 +8353,7 @@ OO.ui.InputWidget.prototype.focus = function () {
* @chainable
*/
OO.ui.InputWidget.prototype.blur = function () {
- this.$input.blur();
+ this.$input[0].blur();
return this;
};
@@ -8426,7 +8441,7 @@ OO.ui.CheckboxInputWidget.prototype.onEdit = function () {
*/
OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) {
var widget = this;
- config = $.extend( { 'maxRows': 10 }, config );
+ config = $.extend( { maxRows: 10 }, config );
// Parent constructor
OO.ui.TextInputWidget.super.call( this, config );
@@ -8449,7 +8464,7 @@ OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) {
this.$( '' )
.addClass( 'oo-ui-textInputWidget-icon oo-ui-icon-' + config.icon )
.mousedown( function () {
- widget.$input.focus();
+ widget.$input[0].focus();
return false;
} )
);
@@ -8457,6 +8472,7 @@ OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) {
if ( config.placeholder ) {
this.$input.attr( 'placeholder', config.placeholder );
}
+ this.$element.attr( 'role', 'textbox' );
};
/* Setup */
@@ -8506,6 +8522,17 @@ OO.ui.TextInputWidget.prototype.onEdit = function () {
return OO.ui.TextInputWidget.super.prototype.onEdit.call( this );
};
+/**
+ * @inheritdoc
+ */
+OO.ui.TextInputWidget.prototype.setValue = function ( value ) {
+ // Parent method
+ OO.ui.TextInputWidget.super.prototype.setValue.call( this, value );
+
+ this.adjustSize();
+ return this;
+};
+
/**
* Automatically adjust the size of the text input.
*
@@ -8519,7 +8546,7 @@ OO.ui.TextInputWidget.prototype.adjustSize = function () {
if ( this.multiline && this.autosize ) {
$clone = this.$input.clone()
.val( this.$input.val() )
- .css( { 'height': 0 } )
+ .css( { height: 0 } )
.insertAfter( this.$input );
// Set inline height property to 0 to measure scroll height
scrollHeight = $clone[0].scrollHeight;
@@ -8712,6 +8739,7 @@ OO.ui.OptionWidget = function OoUiOptionWidget( data, config ) {
this.$element
.data( 'oo-ui-optionWidget', this )
.attr( 'rel', config.rel )
+ .attr( 'role', 'option' )
.addClass( 'oo-ui-optionWidget' )
.append( this.$label );
this.$element
@@ -8976,13 +9004,15 @@ OO.ui.ButtonOptionWidget.prototype.setSelected = function ( state ) {
*/
OO.ui.MenuItemWidget = function OoUiMenuItemWidget( data, config ) {
// Configuration initialization
- config = $.extend( { 'icon': 'check' }, config );
+ config = $.extend( { icon: 'check' }, config );
// Parent constructor
OO.ui.MenuItemWidget.super.call( this, data, config );
// Initialization
- this.$element.addClass( 'oo-ui-menuItemWidget' );
+ this.$element
+ .attr( 'role', 'menuitem' )
+ .addClass( 'oo-ui-menuItemWidget' );
};
/* Setup */
@@ -9187,11 +9217,11 @@ OO.ui.PopupWidget = function OoUiPopupWidget( config ) {
this.width = config.width !== undefined ? config.width : 320;
this.height = config.height !== undefined ? config.height : null;
this.align = config.align || 'center';
- this.closeButton = new OO.ui.ButtonWidget( { '$': this.$, 'framed': false, 'icon': 'close' } );
+ this.closeButton = new OO.ui.ButtonWidget( { $: this.$, framed: false, icon: 'close' } );
this.onMouseDownHandler = OO.ui.bind( this.onMouseDown, this );
// Events
- this.closeButton.connect( this, { 'click': 'onCloseButtonClick' } );
+ this.closeButton.connect( this, { click: 'onCloseButtonClick' } );
// Initialization
this.toggleAnchor( config.anchor === undefined || config.anchor );
@@ -9366,7 +9396,7 @@ OO.ui.PopupWidget.prototype.updateDimensions = function ( transition ) {
containerLeft = Math.round( this.$container.offset().left ),
containerWidth = this.$container.innerWidth(),
containerRight = containerLeft + containerWidth,
- popupOffset = this.width * ( { 'left': 0, 'center': -0.5, 'right': -1 } )[this.align],
+ popupOffset = this.width * ( { left: 0, center: -0.5, right: -1 } )[this.align],
anchorWidth = this.$anchor.width(),
popupLeft = popupOffset - padding,
popupRight = popupOffset + padding + this.width + padding,
@@ -9395,9 +9425,9 @@ OO.ui.PopupWidget.prototype.updateDimensions = function ( transition ) {
// Position body relative to anchor and resize
this.$popup.css( {
- 'left': popupOffset,
- 'width': this.width,
- 'height': this.height !== null ? this.height : 'auto'
+ left: popupOffset,
+ width: this.width,
+ height: this.height !== null ? this.height : 'auto'
} );
if ( transition ) {
@@ -9436,23 +9466,23 @@ OO.ui.SearchWidget = function OoUiSearchWidget( config ) {
// Properties
this.query = new OO.ui.TextInputWidget( {
- '$': this.$,
- 'icon': 'search',
- 'placeholder': config.placeholder,
- 'value': config.value
+ $: this.$,
+ icon: 'search',
+ placeholder: config.placeholder,
+ value: config.value
} );
- this.results = new OO.ui.SelectWidget( { '$': this.$ } );
+ this.results = new OO.ui.SelectWidget( { $: this.$ } );
this.$query = this.$( '' );
this.$results = this.$( '
' );
// Events
this.query.connect( this, {
- 'change': 'onQueryChange',
- 'enter': 'onQueryEnter'
+ change: 'onQueryChange',
+ enter: 'onQueryEnter'
} );
this.results.connect( this, {
- 'highlight': 'onResultsHighlight',
- 'select': 'onResultsSelect'
+ highlight: 'onResultsHighlight',
+ select: 'onResultsSelect'
} );
this.query.$input.on( 'keydown', OO.ui.bind( this.onQueryKeydown, this ) );
@@ -9603,9 +9633,9 @@ OO.ui.SelectWidget = function OoUiSelectWidget( config ) {
// Events
this.$element.on( {
- 'mousedown': OO.ui.bind( this.onMouseDown, this ),
- 'mouseover': OO.ui.bind( this.onMouseOver, this ),
- 'mouseleave': OO.ui.bind( this.onMouseLeave, this )
+ mousedown: OO.ui.bind( this.onMouseDown, this ),
+ mouseover: OO.ui.bind( this.onMouseOver, this ),
+ mouseleave: OO.ui.bind( this.onMouseLeave, this )
} );
// Initialization
@@ -10158,6 +10188,7 @@ OO.ui.MenuWidget = function OoUiMenuWidget( config ) {
// Initialization
this.$element
.hide()
+ .attr( 'role', 'menu' )
.addClass( 'oo-ui-menuWidget' );
};
@@ -10330,7 +10361,7 @@ OO.ui.MenuWidget.prototype.toggle = function ( visible ) {
// Change focus to enable keyboard navigation
if ( this.isolated && this.$input && !this.$input.is( ':focus' ) ) {
this.$previousFocus = this.$( ':focus' );
- this.$input.focus();
+ this.$input[0].focus();
}
if ( this.newItems && this.newItems.length ) {
for ( i = 0, len = this.newItems.length; i < len; i++ ) {
@@ -10349,7 +10380,7 @@ OO.ui.MenuWidget.prototype.toggle = function ( visible ) {
} else {
this.unbindKeyDownListener();
if ( this.isolated && this.$previousFocus ) {
- this.$previousFocus.focus();
+ this.$previousFocus[0].focus();
this.$previousFocus = null;
}
this.getElementDocument().removeEventListener(