aboutsummaryrefslogtreecommitdiffstats
path: root/resources/lib/oojs-ui/oojs-ui.js
diff options
context:
space:
mode:
authorRoan Kattouw <roan.kattouw@gmail.com>2014-04-16 11:09:43 -0700
committerRoan Kattouw <roan.kattouw@gmail.com>2014-04-16 11:09:51 -0700
commitad4d3f159336850db894e881605ef78851c2a8e9 (patch)
treeab7d65be51cb9af24fc9d665a7d40ac9427d96c1 /resources/lib/oojs-ui/oojs-ui.js
parent71fc56f11bdb1de5af9d7ac6abbed45b5b39aee7 (diff)
downloadmediawikicore-ad4d3f159336850db894e881605ef78851c2a8e9.tar.gz
mediawikicore-ad4d3f159336850db894e881605ef78851c2a8e9.zip
Update OOjs UI to v0.1.0-pre (c58b498573)
New changes: 4bf6a2e Buttons return false on mouse down c0eeb38 Only blur inputs within booklet pages when moving away 099f26e Make fieldset layouts render correctly Change-Id: I919b9587242d4f40ffc2943d39bd91695a7c07e7
Diffstat (limited to 'resources/lib/oojs-ui/oojs-ui.js')
-rw-r--r--resources/lib/oojs-ui/oojs-ui.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js
index 3878a65b4a38..6ea6ec9f2d27 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 (8197f2cd2e)
+ * OOjs UI v0.1.0-pre (c58b498573)
* 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: Tue Apr 15 2014 11:07:39 GMT-0700 (PDT)
+ * Date: Wed Apr 16 2014 11:09:39 GMT-0700 (PDT)
*/
( function ( OO ) {
@@ -1890,6 +1890,7 @@ OO.ui.ButtonedElement.prototype.onMouseDown = function () {
.removeAttr( 'tabindex' )
.addClass( 'oo-ui-buttonedElement-pressed' );
this.getElementDocument().addEventListener( 'mouseup', this.onMouseUpHandler, true );
+ return false;
};
/**
@@ -3637,7 +3638,7 @@ OO.ui.FieldsetLayout = function OoUiFieldsetLayout( config ) {
// Mixin constructors
OO.ui.IconedElement.call( this, this.$( '<div>' ), config );
- OO.ui.LabeledElement.call( this, this.$( '<legend>' ), config );
+ OO.ui.LabeledElement.call( this, this.$( '<div>' ), config );
OO.ui.GroupElement.call( this, this.$( '<div>' ), config );
// Initialization
@@ -3658,7 +3659,7 @@ OO.mixinClass( OO.ui.FieldsetLayout, OO.ui.GroupElement );
/* Static Properties */
-OO.ui.FieldsetLayout.static.tagName = 'fieldset';
+OO.ui.FieldsetLayout.static.tagName = 'div';
/**
* Layout made of a field and optional label.
*
@@ -4041,14 +4042,11 @@ OO.inheritClass( OO.ui.BookletLayout, OO.ui.Layout );
OO.ui.BookletLayout.prototype.onStackLayoutFocus = function ( e ) {
var name, $target;
- if ( this.ignoreFocus ) {
- // Avoid recursion from programmatic focus trigger in #onStackLayoutSet
- return;
- }
-
+ // Find the page that an element was focused within
$target = $( e.target ).closest( '.oo-ui-pageLayout' );
for ( name in this.pages ) {
- if ( this.pages[ name ].$element[0] === $target[0] ) {
+ // Check for page match, exclude current page to find only page changes
+ if ( this.pages[name].$element[0] === $target[0] && name !== this.currentPageName ) {
this.setPage( name );
break;
}
@@ -4062,13 +4060,13 @@ OO.ui.BookletLayout.prototype.onStackLayoutFocus = function ( e ) {
*/
OO.ui.BookletLayout.prototype.onStackLayoutSet = function ( page ) {
if ( page ) {
- this.stackLayout.$element.find( ':focus' ).blur();
page.scrollElementIntoView( { 'complete': OO.ui.bind( function () {
- this.ignoreFocus = true;
if ( this.autoFocus ) {
- page.$element.find( ':input:first' ).focus();
+ // 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();
+ }
}
- this.ignoreFocus = false;
}, this ) } );
}
};
@@ -4329,6 +4327,12 @@ OO.ui.BookletLayout.prototype.setPage = function ( name ) {
if ( page ) {
if ( this.currentPageName && this.pages[this.currentPageName] ) {
this.pages[this.currentPageName].setActive( false );
+ // Blur anything focused if the next page doesn't have anything focusable - this
+ // 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();
+ }
}
this.currentPageName = name;
this.stackLayout.setItem( page );