diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 1e7aad08d3..6298e77a86 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -15,12 +15,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.0.92", - "_release": "1.0.92", + "version": "1.0.94", + "_release": "1.0.94", "_resolution": { "type": "version", - "tag": "1.0.92", - "commit": "31046563fca4f28a30c1ae6f6d124a2714649398" + "tag": "1.0.94", + "commit": "5a8fd76f8b8d8096f9aca548127e8d0c2bfe81f9" }, "_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_target": "~1.0.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/confirm/confirm.js b/dashboard-ui/bower_components/emby-webcomponents/confirm/confirm.js index 68d020c7be..e1feb03400 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/confirm/confirm.js +++ b/dashboard-ui/bower_components/emby-webcomponents/confirm/confirm.js @@ -17,15 +17,15 @@ define(['layoutManager', 'dialogText'], function (layoutManager, dialogText) { id: 'cancel' }); - actionsheet.show({ + actionSheet.show({ - title: options.title, + title: options.text, items: items }).then(function (id) { switch (id) { - + case 'ok': resolve(); break; @@ -39,17 +39,79 @@ define(['layoutManager', 'dialogText'], function (layoutManager, dialogText) { }); } - function showConfirm(options) { + function showConfirmInternal(options, paperdialoghelper, resolve, reject) { + var dialogOptions = { + removeOnClose: true + }; + + var backButton = false; + + if (layoutManager.tv) { + dialogOptions.size = 'fullscreen'; + backButton = true; + dialogOptions.autoFocus = true; + } else { + + dialogOptions.modal = false; + dialogOptions.entryAnimationDuration = 160; + dialogOptions.exitAnimationDuration = 200; + dialogOptions.autoFocus = false; + } + + var dlg = paperdialoghelper.createDialog(dialogOptions); + var html = ''; + + if (options.title) { + html += '

' + options.title + '

'; + } + + if (options.text) { + html += '
' + options.text + '
'; + } + + html += '
'; + + html += '' + dialogText.get('Ok') + ''; + + html += '' + dialogText.get('Cancel') + ''; + + html += '
'; + + dlg.innerHTML = html; + document.body.appendChild(dlg); + + paperdialoghelper.open(dlg).then(function () { + + var confirmed = dlg.closingReason.confirmed; + + if (confirmed) { + resolve(); + } else { + reject(); + } + }); } - return function (options) { + function showConfirm(options) { + return new Promise(function (resolve, reject) { - if (typeof options === 'string') { + require(['paperdialoghelper', 'paper-button'], function (paperdialoghelper) { + showConfirmInternal(options, paperdialoghelper, resolve, reject); + }); + }); + } + + return function (text, title) { + + var options; + if (typeof text === 'string') { options = { - title: '', - text: options + title: title, + text: text }; + } else { + options = text; } if (layoutManager.tv) { diff --git a/dashboard-ui/bower_components/iron-icon/.bower.json b/dashboard-ui/bower_components/iron-icon/.bower.json index 1dd6bd32f0..75ac273a15 100644 --- a/dashboard-ui/bower_components/iron-icon/.bower.json +++ b/dashboard-ui/bower_components/iron-icon/.bower.json @@ -31,14 +31,14 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/polymerelements/iron-icon", + "homepage": "https://github.com/PolymerElements/iron-icon", "_release": "1.0.7", "_resolution": { "type": "version", "tag": "v1.0.7", "commit": "6f4d152dc3998a6cc12a5a585a654f893dc99381" }, - "_source": "git://github.com/polymerelements/iron-icon.git", + "_source": "git://github.com/PolymerElements/iron-icon.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-icon" + "_originalSource": "PolymerElements/iron-icon" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-overlay-behavior/.bower.json b/dashboard-ui/bower_components/iron-overlay-behavior/.bower.json index 6352d03f0a..e0183b2eb7 100644 --- a/dashboard-ui/bower_components/iron-overlay-behavior/.bower.json +++ b/dashboard-ui/bower_components/iron-overlay-behavior/.bower.json @@ -1,6 +1,6 @@ { "name": "iron-overlay-behavior", - "version": "1.3.3", + "version": "1.4.0", "license": "http://polymer.github.io/LICENSE.txt", "description": "Provides a behavior for making an element an overlay", "private": true, @@ -19,6 +19,7 @@ "url": "git://github.com/PolymerElements/iron-overlay-behavior.git" }, "dependencies": { + "iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0", "iron-fit-behavior": "PolymerElements/iron-fit-behavior#^1.0.0", "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0", "polymer": "Polymer/polymer#^1.0.0" @@ -34,11 +35,11 @@ }, "ignore": [], "homepage": "https://github.com/polymerelements/iron-overlay-behavior", - "_release": "1.3.3", + "_release": "1.4.0", "_resolution": { "type": "version", - "tag": "v1.3.3", - "commit": "7279b3bedd0f0dd70dbfb3d7557d1f49c7432941" + "tag": "v1.4.0", + "commit": "9731850e81b004723f0c1878a85479f7aa9cfda1" }, "_source": "git://github.com/polymerelements/iron-overlay-behavior.git", "_target": "^1.0.0", diff --git a/dashboard-ui/bower_components/iron-overlay-behavior/bower.json b/dashboard-ui/bower_components/iron-overlay-behavior/bower.json index 97f3076dad..04d51e1b33 100644 --- a/dashboard-ui/bower_components/iron-overlay-behavior/bower.json +++ b/dashboard-ui/bower_components/iron-overlay-behavior/bower.json @@ -1,6 +1,6 @@ { "name": "iron-overlay-behavior", - "version": "1.3.3", + "version": "1.4.0", "license": "http://polymer.github.io/LICENSE.txt", "description": "Provides a behavior for making an element an overlay", "private": true, @@ -19,6 +19,7 @@ "url": "git://github.com/PolymerElements/iron-overlay-behavior.git" }, "dependencies": { + "iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0", "iron-fit-behavior": "PolymerElements/iron-fit-behavior#^1.0.0", "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0", "polymer": "Polymer/polymer#^1.0.0" diff --git a/dashboard-ui/bower_components/iron-overlay-behavior/iron-overlay-behavior.html b/dashboard-ui/bower_components/iron-overlay-behavior/iron-overlay-behavior.html index e9f4f0776e..4929a393e0 100644 --- a/dashboard-ui/bower_components/iron-overlay-behavior/iron-overlay-behavior.html +++ b/dashboard-ui/bower_components/iron-overlay-behavior/iron-overlay-behavior.html @@ -9,6 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN --> + @@ -118,6 +119,15 @@ context. You should place this element as a child of `` whenever possible. type: Object }, + /** + * The HTMLElement that will be firing relevant KeyboardEvents. + * Used for capturing esc and tab. Overridden from `IronA11yKeysBehavior`. + */ + keyEventTarget: { + type: Object, + value: document + }, + _manager: { type: Object, value: Polymer.IronOverlayManager @@ -130,13 +140,6 @@ context. You should place this element as a child of `` whenever possible. } }, - _boundOnCaptureKeydown: { - type: Function, - value: function() { - return this._onCaptureKeydown.bind(this); - } - }, - _boundOnCaptureFocus: { type: Function, value: function() { @@ -144,33 +147,99 @@ context. You should place this element as a child of `` whenever possible. } }, - /** @type {?Node} */ + /** + * The node being focused. + * @type {?Node} + */ _focusedChild: { type: Object } }, + keyBindings: { + 'esc': '__onEsc', + 'tab': '__onTab' + }, + listeners: { 'iron-resize': '_onIronResize' }, /** * The backdrop element. - * @type Node + * @type {Node} */ get backdropElement() { return this._manager.backdropElement; }, + /** + * Returns the node to give focus to. + * @type {Node} + */ get _focusNode() { - return this._focusedChild || Polymer.dom(this).querySelector('[autofocus]') || this; + return this._focusedChild || Polymer.dom(this).querySelector('[autofocus]') || this.__firstFocusableNode || this; + }, + + /** + * Array of nodes that can receive focus (overlay included), ordered by `tabindex`. + * This is used to retrieve which is the first and last focusable nodes in order + * to wrap the focus for overlays `with-backdrop`. + * + * If you know what is your content (specifically the first and last focusable children), + * you can override this method to return only `[firstFocusable, lastFocusable];` + * @type {[Node]} + * @protected + */ + get _focusableNodes() { + // Elements that can be focused even if they have [disabled] attribute. + var FOCUSABLE_WITH_DISABLED = [ + 'a[href]', + 'area[href]', + 'iframe', + '[tabindex]', + '[contentEditable=true]' + ]; + + // Elements that cannot be focused if they have [disabled] attribute. + var FOCUSABLE_WITHOUT_DISABLED = [ + 'input', + 'select', + 'textarea', + 'button' + ]; + + // Discard elements with tabindex=-1 (makes them not focusable). + var selector = FOCUSABLE_WITH_DISABLED.join(':not([tabindex="-1"]),') + + ':not([tabindex="-1"]),' + + FOCUSABLE_WITHOUT_DISABLED.join(':not([disabled]):not([tabindex="-1"]),') + + ':not([disabled]):not([tabindex="-1"])'; + + var focusables = Polymer.dom(this).querySelectorAll(selector); + if (this.tabIndex >= 0) { + // Insert at the beginning because we might have all elements with tabIndex = 0, + // and the overlay should be the first of the list. + focusables.splice(0, 0, this); + } + // Sort by tabindex. + return focusables.sort(function (a, b) { + if (a.tabIndex === b.tabIndex) { + return 0; + } + if (a.tabIndex === 0 || a.tabIndex > b.tabIndex) { + return 1; + } + return -1; + }); }, ready: function() { // with-backdrop need tabindex to be set in order to trap the focus. // If it is not set, IronOverlayBehavior will set it, and remove it if with-backdrop = false. this.__shouldRemoveTabIndex = false; + // Used for wrapping the focus on TAB / Shift+TAB. + this.__firstFocusableNode = this.__lastFocusableNode = null; this._ensureSetup(); }, @@ -321,9 +390,8 @@ context. You should place this element as a child of `` whenever possible. } }, - _toggleListeners: function () { + _toggleListeners: function() { this._toggleListener(this.opened, document, 'tap', this._boundOnCaptureClick, true); - this._toggleListener(this.opened, document, 'keydown', this._boundOnCaptureKeydown, true); this._toggleListener(this.opened, document, 'focus', this._boundOnCaptureFocus, true); }, @@ -425,18 +493,8 @@ context. You should place this element as a child of `` whenever possible. } }, - _onCaptureKeydown: function(event) { - var ESC = 27; - if (this._manager.currentOverlay() === this && - !this.noCancelOnEscKey && - event.keyCode === ESC) { - this.cancel(event); - } - }, - _onCaptureFocus: function (event) { - if (this._manager.currentOverlay() === this && - this.withBackdrop) { + if (this._manager.currentOverlay() === this && this.withBackdrop) { var path = Polymer.dom(event).path; if (path.indexOf(this) === -1) { event.stopPropagation(); @@ -462,6 +520,37 @@ context. You should place this element as a child of `` whenever possible. if (this.opened) { this.notifyResize(); } + // Store it so we don't query too much. + var focusableNodes = this._focusableNodes; + this.__firstFocusableNode = focusableNodes[0]; + this.__lastFocusableNode = focusableNodes[focusableNodes.length - 1]; + }, + + __onEsc: function(event) { + // Not opened or not on top, so return. + if (this._manager.currentOverlay() !== this) { + return; + } + if (!this.noCancelOnEscKey) { + this.cancel(event); + } + }, + + __onTab: function(event) { + // Not opened or not on top, so return. + if (this._manager.currentOverlay() !== this) { + return; + } + // TAB wraps from last to first focusable. + // Shift + TAB wraps from first to last focusable. + var shift = event.detail.keyboardEvent.shiftKey; + var nodeToCheck = shift ? this.__firstFocusableNode : this.__lastFocusableNode; + var nodeToSet = shift ? this.__lastFocusableNode : this.__firstFocusableNode; + if (this.withBackdrop && this._focusedChild === nodeToCheck) { + // We set here the _focusedChild so that _onCaptureFocus will handle the + // wrapping of the focus (the next event after tab is focus). + this._focusedChild = nodeToSet; + } } /** @@ -484,7 +573,7 @@ context. You should place this element as a child of `` whenever possible. }; /** @polymerBehavior */ - Polymer.IronOverlayBehavior = [Polymer.IronFitBehavior, Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl]; + Polymer.IronOverlayBehavior = [Polymer.IronA11yKeysBehavior, Polymer.IronFitBehavior, Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl]; diff --git a/dashboard-ui/bower_components/iron-overlay-behavior/test/iron-overlay-behavior.html b/dashboard-ui/bower_components/iron-overlay-behavior/test/iron-overlay-behavior.html index b6cfa22749..8dcc52968d 100644 --- a/dashboard-ui/bower_components/iron-overlay-behavior/test/iron-overlay-behavior.html +++ b/dashboard-ui/bower_components/iron-overlay-behavior/test/iron-overlay-behavior.html @@ -63,6 +63,33 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN + + + +