Update OOjs UI to v0.1.0-pre (c58b498573)
authorRoan Kattouw <roan.kattouw@gmail.com>
Wed, 16 Apr 2014 18:09:43 +0000 (11:09 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Wed, 16 Apr 2014 18:09:51 +0000 (11:09 -0700)
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

resources/lib/oojs-ui/oojs-ui-apex.css
resources/lib/oojs-ui/oojs-ui.js
resources/lib/oojs-ui/oojs-ui.svg.css

index 64a8e38..b6e8d3a 100644 (file)
   border: none;
 }
 
-.oo-ui-fieldsetLayout > legend.oo-ui-labeledElement-label {
+.oo-ui-fieldsetLayout > .oo-ui-labeledElement-label {
   font-size: 1.5em;
 }
 
index 3878a65..6ea6ec9 100644 (file)
@@ -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 );
index 0353288..6423a4c 100644 (file)
@@ -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:38 GMT-0700 (PDT)
  */
 
 /* Textures */
   margin-top: -0.75em;
 }
 
-.oo-ui-fieldsetLayout > legend.oo-ui-labeledElement-label {
+.oo-ui-fieldsetLayout > .oo-ui-labeledElement-label {
   padding: 0.25em 0;
   margin-bottom: 0.5em;
 }
 
-.oo-ui-fieldsetLayout.oo-ui-iconedElement > legend.oo-ui-labeledElement-label {
+.oo-ui-fieldsetLayout.oo-ui-iconedElement > .oo-ui-labeledElement-label {
   padding-left: 1.75em;
+  line-height: 1.33em;
 }
 
 .oo-ui-fieldsetLayout.oo-ui-iconedElement > .oo-ui-iconedElement-icon {
   position: absolute;
-  top: 0;
+  top: 0.25em;
   left: 0;
   display: block;
   width: 2em;