1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update prompt text

This commit is contained in:
Luke Pulverenti 2016-02-06 01:33:34 -05:00
parent b63aaeb909
commit ed4d08ab68
22 changed files with 401 additions and 146 deletions

View file

@ -1,6 +1,6 @@
{
"name": "iron-overlay-behavior",
"version": "1.2.0",
"version": "1.3.0",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay",
"private": true,
@ -19,26 +19,25 @@
"url": "git://github.com/PolymerElements/iron-overlay-behavior.git"
},
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0",
"iron-fit-behavior": "PolymerElements/iron-fit-behavior#^1.0.0",
"iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0"
"iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.2",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.2",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
"_release": "1.2.0",
"_release": "1.3.0",
"_resolution": {
"type": "version",
"tag": "v1.2.0",
"commit": "1d8e1d29c601add9c135e5103c4d1d0d652dd957"
"tag": "v1.3.0",
"commit": "b488ce94ec1c17c3a5491af1a2fba2f7382684da"
},
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0",

View file

@ -5,6 +5,11 @@ https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
You can however override the jsbin link with one that's customized to this
specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output
-->
# Polymer Elements
## Guide for Contributors
@ -41,7 +46,7 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output).
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
@ -51,14 +56,14 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, #40
Fixes #32, fixes #40
```
2. **A succinct description of the design** used to fix any related issues. For example:

View file

@ -1,6 +1,6 @@
{
"name": "iron-overlay-behavior",
"version": "1.2.0",
"version": "1.3.0",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay",
"private": true,
@ -19,16 +19,15 @@
"url": "git://github.com/PolymerElements/iron-overlay-behavior.git"
},
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0",
"iron-fit-behavior": "PolymerElements/iron-fit-behavior#^1.0.0",
"iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0"
"iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.2",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.2",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},

View file

@ -120,7 +120,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<button data-dialog="backdrop">backdrop</button>
<simple-overlay id="backdrop" with-backdrop>
Hello world!
<p>Hello world!</p>
<button>button</button>
<button>button</button>
<button>button</button>
</simple-overlay>
<button data-dialog="autofocus">autofocus</button>

View file

@ -118,10 +118,14 @@ Custom property | Description | Default
this.style.zIndex = this._manager.backdropZ();
// close only if no element with backdrop is left
if (this._manager.getBackdrops().length === 0) {
// Read style before setting opened.
var cs = getComputedStyle(this);
var noAnimation = (cs.transitionDuration === '0s' || cs.opacity == 0);
this._setOpened(false);
// complete() will be called after the transition is done.
// If animations are disabled via custom-styles, user is expected to call
// complete() after close()
// In case of no animations, complete
if (noAnimation) {
this.complete();
}
}
},

View file

@ -135,6 +135,18 @@ context. You should place this element as a child of `<body>` whenever possible.
value: function() {
return this._onCaptureKeydown.bind(this);
}
},
_boundOnCaptureFocus: {
type: Function,
value: function() {
return this._onCaptureFocus.bind(this);
}
},
/** @type {?Node} */
_focusedChild: {
type: Object
}
},
@ -152,10 +164,13 @@ context. You should place this element as a child of `<body>` whenever possible.
},
get _focusNode() {
return Polymer.dom(this).querySelector('[autofocus]') || this;
return this._focusedChild || Polymer.dom(this).querySelector('[autofocus]') || this;
},
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;
this._ensureSetup();
},
@ -265,6 +280,14 @@ context. You should place this element as a child of `<body>` whenever possible.
},
_withBackdropChanged: function() {
// If tabindex is already set, no need to override it.
if (this.withBackdrop && !this.hasAttribute('tabindex')) {
this.setAttribute('tabindex', '-1');
this.__shouldRemoveTabIndex = true;
} else if (this.__shouldRemoveTabIndex) {
this.removeAttribute('tabindex');
this.__shouldRemoveTabIndex = false;
}
if (this.opened) {
this._manager.trackBackdrop(this);
if (this.withBackdrop) {
@ -298,6 +321,7 @@ context. You should place this element as a child of `<body>` whenever possible.
_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);
},
// tasks which must occur before opening; e.g. making the element visible
@ -343,6 +367,7 @@ context. You should place this element as a child of `<body>` whenever possible.
this.style.display = 'none';
this._manager.removeOverlay(this);
this._focusedChild = null;
this._applyFocus();
this.notifyResize();
@ -376,9 +401,12 @@ context. You should place this element as a child of `<body>` whenever possible.
_onCaptureClick: function(event) {
if (this._manager.currentOverlay() === this &&
!this.noCancelOnOutsideClick &&
Polymer.dom(event).path.indexOf(this) === -1) {
this.cancel();
if (this.noCancelOnOutsideClick) {
this._applyFocus();
} else {
this.cancel();
}
}
},
@ -391,6 +419,19 @@ context. You should place this element as a child of `<body>` whenever possible.
}
},
_onCaptureFocus: function (event) {
if (this._manager.currentOverlay() === this &&
this.withBackdrop) {
var path = Polymer.dom(event).path;
if (path.indexOf(this) === -1) {
event.stopPropagation();
this._applyFocus();
} else {
this._focusedChild = path[0];
}
}
},
_onIronResize: function() {
if (this.opened) {
this.refit();

View file

@ -323,6 +323,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('no-cancel-on-outside-click property; focus stays on overlay when click outside', function(done) {
overlay = fixture('autofocus');
overlay.noCancelOnOutsideClick = true;
runAfterOpen(overlay, function() {
MockInteractions.tap(document.body);
setTimeout(function() {
assert.equal(Polymer.dom(overlay).querySelector('[autofocus]'), document.activeElement, '<button autofocus> is focused');
done();
}, 10);
});
});
test('no-cancel-on-esc-key property', function(done) {
overlay.noCancelOnEscKey = true;
runAfterOpen(overlay, function() {
@ -465,6 +478,42 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlays[0].opened = false;
assert.equal(overlays[0]._manager.getBackdrops().length, 0, 'overlay removed from manager backdrops');
});
test('with-backdrop sets tabindex=-1 and removes it', function() {
var overlay = fixture('basic');
overlay.withBackdrop = true;
assert.equal(overlay.getAttribute('tabindex'), '-1', 'tabindex is -1');
overlay.withBackdrop = false;
assert.isFalse(overlay.hasAttribute('tabindex'), 'tabindex removed');
});
test('with-backdrop does not override tabindex if already set', function() {
var overlay = fixture('basic');
overlay.setAttribute('tabindex', '1');
overlay.withBackdrop = true;
assert.equal(overlay.getAttribute('tabindex'), '1', 'tabindex is 1');
overlay.withBackdrop = false;
assert.equal(overlay.getAttribute('tabindex'), '1', 'tabindex is still 1');
});
test('with-backdrop traps the focus within the overlay', function(done) {
// Add button to try to "steal" focus.
var button = document.createElement('button');
var focusSpy = sinon.stub();
button.addEventListener('focus', focusSpy, true);
document.body.appendChild(button);
var overlay = fixture('autofocus');
overlay.withBackdrop = true;
runAfterOpen(overlay, function() {
// Try to steal the focus
MockInteractions.focus(button);
assert.isFalse(focusSpy.called, 'button in body did not get the focus');
assert.equal(Polymer.dom(overlay).querySelector('[autofocus]'), document.activeElement, '<button autofocus> is focused');
button.parentNode.removeChild(button);
done();
});
});
});
suite('multiple overlays with backdrop', function() {
@ -492,17 +541,31 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
test('updating with-backdrop to false closes backdrop', function(done) {
// no waiting for animations
overlays[0].backdropElement.style.transitionDuration = '0s';
runAfterOpen(overlays[0], function() {
overlays[0].withBackdrop = false;
// Don't wait for animations.
overlays[0].backdropElement.complete();
assert.isFalse(overlays[0].backdropElement.opened, 'backdrop is closed');
assert.isNotObject(overlays[0].backdropElement.parentNode, 'backdrop is removed from document');
overlays[0].backdropElement.style.transitionDuration = '';
done();
});
});
test('backdrop is removed when toggling overlay opened', function(done) {
overlays[0].open();
assert.isObject(overlays[0].backdropElement.parentNode, 'backdrop is immediately inserted in the document');
overlays[0].close();
// Wait a tick (overlay will call backdropElement.close in the _openChangedAsync)
setTimeout(function() {
assert.isFalse(overlays[0].backdropElement.opened, 'backdrop is closed');
assert.isNotObject(overlays[0].backdropElement.parentNode, 'backdrop is removed from document');
done();
}, 1);
});
test('updating with-backdrop updates z-index', function(done) {
runAfterOpen(overlays[0], function() {
runAfterOpen(overlays[1], function() {

View file

@ -0,0 +1,40 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer/polymer.html">
<dom-module id="test-buttons">
<style>
:host {
border: 1px solid black;
padding: 10px;
}
</style>
<template>
<button id="button0">button0</button>
<button id="button1">button1</button>
<button id="button2">button2</button>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'test-buttons'
});
})();
</script>