From: James D. Forrester Date: Wed, 18 Jun 2014 23:19:20 +0000 (-0700) Subject: Update OOjs UI to v0.1.0-pre (7a0e222a75) X-Git-Tag: 1.31.0-rc.0~15344 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=978bdd7d28cc6e3bd3929e83c1131b746a4b5395;p=lhc%2Fweb%2Fwiklou.git Update OOjs UI to v0.1.0-pre (7a0e222a75) New changes: ef2f66f Element: Add unit tests for focusin/focusout hack 54b09fd Element: Remove focusin/focusout hack in onDOMEvent 91ba7d3 Accessibility: Set role=dialog on dialogs 0447150 Accessibility: Restore element focus when a window closes 715f1ef Localisation updates from https://translatewiki.net. 9f343c0 Localisation updates from https://translatewiki.net. 6be64bc Tidy up SVG sources and fix pixel snapping 7a0e222 Fix scrollIntoView() in the case where the scrollable container is the Change-Id: I9d86a238546acc867f20aeb45b102c7499108c89 --- diff --git a/resources/lib/oojs-ui/i18n/ce.json b/resources/lib/oojs-ui/i18n/ce.json index 122be19819..de86daf0f4 100644 --- a/resources/lib/oojs-ui/i18n/ce.json +++ b/resources/lib/oojs-ui/i18n/ce.json @@ -9,7 +9,7 @@ "ooui-outline-control-move-down": "Лаха яккха элемент", "ooui-outline-control-move-up": "Лаккха яккха элемент", "ooui-outline-control-remove": "ДӀадаха меттиг", - "ooui-toolbar-more": "Кхин тӀе", + "ooui-toolbar-more": "Кхин", "ooui-dialog-confirm-title": "Бакъдан", "ooui-dialog-confirm-default-prompt": "Бакъалла лаьий хӀуна?", "ooui-dialog-confirm-default-ok": "ХӀаъ", diff --git a/resources/lib/oojs-ui/i18n/kn.json b/resources/lib/oojs-ui/i18n/kn.json index 76b654b810..85931f573f 100644 --- a/resources/lib/oojs-ui/i18n/kn.json +++ b/resources/lib/oojs-ui/i18n/kn.json @@ -6,6 +6,8 @@ ] }, "ooui-dialog-action-close": "ಮುಚ್ಚಿ", + "ooui-outline-control-move-down": "ವಸ್ತು ಕೆಲ್ಗೆ ಸ್ಥಲಾನ್ಥರಿಸು", + "ooui-outline-control-move-up": "ವಸ್ತು ಮೆಲೆ ಸ್ಥಲಾನ್ಥರಿಸು", "ooui-outline-control-remove": "ವಸ್ತು ತೆಗೆ", "ooui-toolbar-more": "ಹೆಚ್ಚು", "ooui-dialog-confirm-title": "ಧೃಡಪಡಿಸು", diff --git a/resources/lib/oojs-ui/images/indicators/alert.svg b/resources/lib/oojs-ui/images/indicators/alert.svg index 8ce4b25928..e549b178bc 100644 --- a/resources/lib/oojs-ui/images/indicators/alert.svg +++ b/resources/lib/oojs-ui/images/indicators/alert.svg @@ -1,8 +1,9 @@ - + - + diff --git a/resources/lib/oojs-ui/images/indicators/arrow-down.png b/resources/lib/oojs-ui/images/indicators/arrow-down.png index 47ff54cbed..64e3bac3b8 100644 Binary files a/resources/lib/oojs-ui/images/indicators/arrow-down.png and b/resources/lib/oojs-ui/images/indicators/arrow-down.png differ diff --git a/resources/lib/oojs-ui/images/indicators/arrow-down.svg b/resources/lib/oojs-ui/images/indicators/arrow-down.svg index c871f603d7..89c21e3398 100644 --- a/resources/lib/oojs-ui/images/indicators/arrow-down.svg +++ b/resources/lib/oojs-ui/images/indicators/arrow-down.svg @@ -1,8 +1,8 @@ + height="12px" viewBox="0 0 12 12"> - + diff --git a/resources/lib/oojs-ui/images/indicators/arrow-ltr.png b/resources/lib/oojs-ui/images/indicators/arrow-ltr.png index 79840079ea..4eafd0fc06 100644 Binary files a/resources/lib/oojs-ui/images/indicators/arrow-ltr.png and b/resources/lib/oojs-ui/images/indicators/arrow-ltr.png differ diff --git a/resources/lib/oojs-ui/images/indicators/arrow-ltr.svg b/resources/lib/oojs-ui/images/indicators/arrow-ltr.svg index cbc22a4799..ad87640b20 100644 --- a/resources/lib/oojs-ui/images/indicators/arrow-ltr.svg +++ b/resources/lib/oojs-ui/images/indicators/arrow-ltr.svg @@ -1,8 +1,8 @@ + height="12px" viewBox="0 0 12 12"> - + diff --git a/resources/lib/oojs-ui/images/indicators/arrow-rtl.png b/resources/lib/oojs-ui/images/indicators/arrow-rtl.png index eebd509cc4..ce13ba05df 100644 Binary files a/resources/lib/oojs-ui/images/indicators/arrow-rtl.png and b/resources/lib/oojs-ui/images/indicators/arrow-rtl.png differ diff --git a/resources/lib/oojs-ui/images/indicators/arrow-rtl.svg b/resources/lib/oojs-ui/images/indicators/arrow-rtl.svg index 71f73d5fa3..010b24e7bd 100644 --- a/resources/lib/oojs-ui/images/indicators/arrow-rtl.svg +++ b/resources/lib/oojs-ui/images/indicators/arrow-rtl.svg @@ -1,8 +1,8 @@ + height="12px" viewBox="0 0 12 12"> - + diff --git a/resources/lib/oojs-ui/images/indicators/arrow-up.png b/resources/lib/oojs-ui/images/indicators/arrow-up.png index b827f6d54e..401cde6968 100644 Binary files a/resources/lib/oojs-ui/images/indicators/arrow-up.png and b/resources/lib/oojs-ui/images/indicators/arrow-up.png differ diff --git a/resources/lib/oojs-ui/images/indicators/arrow-up.svg b/resources/lib/oojs-ui/images/indicators/arrow-up.svg index a5d7f38293..bbc2b3c44e 100644 --- a/resources/lib/oojs-ui/images/indicators/arrow-up.svg +++ b/resources/lib/oojs-ui/images/indicators/arrow-up.svg @@ -1,8 +1,8 @@ + height="12px" viewBox="0 0 12 12"> - + diff --git a/resources/lib/oojs-ui/images/indicators/required.svg b/resources/lib/oojs-ui/images/indicators/required.svg index ee1baf793a..d8b36b1c56 100644 --- a/resources/lib/oojs-ui/images/indicators/required.svg +++ b/resources/lib/oojs-ui/images/indicators/required.svg @@ -1,10 +1,11 @@ - + - - - + + + diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js index 06553972f9..7e3aadfa98 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 (c5ae888f67) + * OOjs UI v0.1.0-pre (7a0e222a75) * 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: Wed Jun 11 2014 18:10:09 GMT-0700 (PDT) + * Date: Wed Jun 18 2014 16:19:15 GMT-0700 (PDT) */ ( function ( OO ) { @@ -486,18 +486,32 @@ OO.ui.Element.scrollIntoView = function ( el, config ) { // Configuration initialization config = config || {}; - var anim = {}, + var rel, anim = {}, callback = typeof config.complete === 'function' && config.complete, sc = this.getClosestScrollableContainer( el, config.direction ), $sc = $( sc ), eld = this.getDimensions( el ), scd = this.getDimensions( sc ), + $win = $( this.getWindow( el ) ); + + // Compute the distances between the edges of el and the edges of the scroll viewport + if ( $sc.is( 'body' ) ) { + // If the scrollable container is the this is easy + rel = { + 'top': eld.rect.top, + 'bottom': $win.innerHeight() - eld.rect.bottom, + 'left': eld.rect.left, + 'right': $win.innerWidth() - eld.rect.right + }; + } else { + // Otherwise, we have to subtract el's coordinates from sc's coordinates rel = { 'top': eld.rect.top - ( scd.rect.top + scd.borders.top ), 'bottom': scd.rect.bottom - scd.borders.bottom - scd.scrollbar.bottom - eld.rect.bottom, 'left': eld.rect.left - ( scd.rect.left + scd.borders.left ), 'right': scd.rect.right - scd.borders.right - scd.scrollbar.right - eld.rect.right }; + } if ( !config.direction || config.direction === 'y' ) { if ( rel.top < 0 ) { @@ -606,6 +620,7 @@ OO.ui.Element.prototype.scrollElementIntoView = function ( config ) { /** * Bind a handler for an event on this.$element * + * @deprecated Use jQuery#on instead. * @param {string} event * @param {Function} callback */ @@ -616,6 +631,7 @@ OO.ui.Element.prototype.onDOMEvent = function ( event, callback ) { /** * Unbind a handler bound with #offDOMEvent * + * @deprecated Use jQuery#off instead. * @param {string} event * @param {Function} callback */ @@ -624,105 +640,33 @@ OO.ui.Element.prototype.offDOMEvent = function ( event, callback ) { }; ( function () { - // Static - - // jQuery 1.8.3 has a bug with handling focusin/focusout events inside iframes. - // Firefox doesn't support focusin/focusout at all, so we listen for 'focus'/'blur' on the - // document, and simulate a 'focusin'/'focusout' event on the target element and make - // it bubble from there. - // - // - http://jsfiddle.net/sw3hr/ - // - http://bugs.jquery.com/ticket/14180 - // - https://github.com/jquery/jquery/commit/1cecf64e5aa4153 - function specialEvent( simulatedName, realName ) { - function handler( e ) { - jQuery.event.simulate( - simulatedName, - e.target, - jQuery.event.fix( e ), - /* bubble = */ true - ); - } - - return { - setup: function () { - var doc = this.ownerDocument || this, - attaches = $.data( doc, 'ooui-' + simulatedName + '-attaches' ); - if ( !attaches ) { - doc.addEventListener( realName, handler, true ); - } - $.data( doc, 'ooui-' + simulatedName + '-attaches', ( attaches || 0 ) + 1 ); - }, - teardown: function () { - var doc = this.ownerDocument || this, - attaches = $.data( doc, 'ooui-' + simulatedName + '-attaches' ) - 1; - if ( !attaches ) { - doc.removeEventListener( realName, handler, true ); - $.removeData( doc, 'ooui-' + simulatedName + '-attaches' ); - } else { - $.data( doc, 'ooui-' + simulatedName + '-attaches', attaches ); - } - } - }; - } - - var hasOwn = Object.prototype.hasOwnProperty, - specialEvents = { - focusin: specialEvent( 'focusin', 'focus' ), - focusout: specialEvent( 'focusout', 'blur' ) - }; - /** * Bind a handler for an event on a DOM element. * - * Uses jQuery internally for everything except for events which are - * known to have issues in the browser or in jQuery. This method - * should become obsolete eventually. + * Used to be for working around a jQuery bug (jqbug.com/14180), + * but obsolete as of jQuery 1.11.0. * * @static + * @deprecated Use jQuery#on instead. * @param {HTMLElement|jQuery} el DOM element * @param {string} event Event to bind * @param {Function} callback Callback to call when the event fires */ OO.ui.Element.onDOMEvent = function ( el, event, callback ) { - var orig; - - if ( hasOwn.call( specialEvents, event ) ) { - // Replace jQuery's override with our own - orig = $.event.special[event]; - $.event.special[event] = specialEvents[event]; - - $( el ).on( event, callback ); - - // Restore - $.event.special[event] = orig; - } else { - $( el ).on( event, callback ); - } + $( el ).on( event, callback ); }; /** * Unbind a handler bound with #static-method-onDOMEvent. * + * @deprecated Use jQuery#off instead. * @static * @param {HTMLElement|jQuery} el DOM element * @param {string} event Event to unbind * @param {Function} [callback] Callback to unbind */ OO.ui.Element.offDOMEvent = function ( el, event, callback ) { - var orig; - if ( hasOwn.call( specialEvents, event ) ) { - // Replace jQuery's override with our own - orig = $.event.special[event]; - $.event.special[event] = specialEvents[event]; - - $( el ).off( event, callback ); - - // Restore - $.event.special[event] = orig; - } else { - $( el ).off( event, callback ); - } + $( el ).off( event, callback ); }; }() ); /** @@ -1341,6 +1285,10 @@ OO.ui.Window.prototype.open = function ( data ) { // Open the window this.opening = $.Deferred(); + + // So we can restore focus on closing + this.$prevFocus = $( document.activeElement ); + this.frame.load().done( OO.ui.bind( function () { this.$element.show(); this.visible = true; @@ -1404,6 +1352,11 @@ OO.ui.Window.prototype.close = function ( data ) { this.opened.resolve(); } this.$element.hide(); + // Restore focus to whatever was focused before opening + if ( this.$prevFocus ) { + this.$prevFocus.focus(); + this.$prevFocus = undefined; + } this.visible = false; this.closing.resolve(); // Now that we are totally done closing, it's safe to allow opening @@ -1608,7 +1561,7 @@ OO.ui.Dialog = function OoUiDialog( config ) { this.$element.on( 'mousedown', false ); // Initialization - this.$element.addClass( 'oo-ui-dialog' ); + this.$element.addClass( 'oo-ui-dialog' ).attr( 'role', 'dialog' ); this.setSize( config.size ); }; diff --git a/resources/lib/oojs-ui/oojs-ui.svg.css b/resources/lib/oojs-ui/oojs-ui.svg.css index aa4d42e7b3..76feb5d656 100644 --- a/resources/lib/oojs-ui/oojs-ui.svg.css +++ b/resources/lib/oojs-ui/oojs-ui.svg.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (c5ae888f67) + * OOjs UI v0.1.0-pre (7a0e222a75) * 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: Wed Jun 11 2014 18:10:09 GMT-0700 (PDT) + * Date: Wed Jun 18 2014 16:19:15 GMT-0700 (PDT) */ /* Textures */