mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update popups
This commit is contained in:
parent
ae5ccc79dc
commit
a5be57afdc
19 changed files with 255 additions and 78 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-menu-behavior",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "Provides accessible menu behavior",
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
|
@ -29,15 +29,16 @@
|
|||
"devDependencies": {
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.2",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "polymer/web-component-tester#^3.4.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.6",
|
||||
"_release": "1.0.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.6",
|
||||
"commit": "50f4e753b147ab397d81f64f4b2db962c43c4057"
|
||||
"tag": "v1.0.7",
|
||||
"commit": "e5ca054bbe1c24fbc43adb78217ccc50d9223601"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-menu-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -11,7 +11,7 @@ env:
|
|||
- secure: i76J23Bpwj6qJ4ybCCsQpGCTT+5s1PA+x0Avjbl1JTS4OsJLDFfvVl0YIWZ5xMIKJtdPC/mGDoZ2LNrh9hz82DBqDnzBlSnNjFbjnU1Aqy5CUmRWzyAF5NOjJGotISZcDYDGZd6gjsOfN0r+rICyRUiOadeyPf0Nm+6HSVQMjfM=
|
||||
node_js: 4
|
||||
addons:
|
||||
firefox: '42.0'
|
||||
firefox: latest
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-menu-behavior",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "Provides accessible menu behavior",
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
|
@ -29,6 +29,7 @@
|
|||
"devDependencies": {
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.2",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "polymer/web-component-tester#^3.4.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
|
|
|
@ -125,6 +125,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
for (var i = 0, item; item = this.items[i]; i++) {
|
||||
var attr = this.attrForItemTitle || 'textContent';
|
||||
var title = item[attr] || item.getAttribute(attr);
|
||||
|
||||
if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
||||
this._setFocusedItem(item);
|
||||
break;
|
||||
|
@ -165,7 +166,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
} else {
|
||||
item.removeAttribute('aria-selected');
|
||||
}
|
||||
|
||||
Polymer.IronSelectableBehavior._applySelection.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
@ -213,18 +213,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
* @param {CustomEvent} event A key combination event.
|
||||
*/
|
||||
_onShiftTabDown: function(event) {
|
||||
var oldTabIndex;
|
||||
var oldTabIndex = this.getAttribute('tabindex');
|
||||
|
||||
Polymer.IronMenuBehaviorImpl._shiftTabPressed = true;
|
||||
|
||||
oldTabIndex = this.getAttribute('tabindex');
|
||||
this._setFocusedItem(null);
|
||||
|
||||
this.setAttribute('tabindex', '-1');
|
||||
|
||||
this.async(function() {
|
||||
this.setAttribute('tabindex', oldTabIndex);
|
||||
Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
|
||||
// NOTE(cdata): polymer/polymer#1305
|
||||
// NOTE(cdata): polymer/polymer#1305
|
||||
}, 1);
|
||||
},
|
||||
|
||||
|
@ -235,23 +235,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
*/
|
||||
_onFocus: function(event) {
|
||||
if (Polymer.IronMenuBehaviorImpl._shiftTabPressed) {
|
||||
// do not focus the menu itself
|
||||
return;
|
||||
}
|
||||
// do not focus the menu itself
|
||||
|
||||
this.blur();
|
||||
|
||||
// clear the cached focus item
|
||||
this._setFocusedItem(null);
|
||||
this._defaultFocusAsync = this.async(function() {
|
||||
// focus the selected item when the menu receives focus, or the first item
|
||||
// if no item is selected
|
||||
var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem;
|
||||
|
||||
this._setFocusedItem(null);
|
||||
|
||||
if (selectedItem) {
|
||||
this._setFocusedItem(selectedItem);
|
||||
} else {
|
||||
this._setFocusedItem(this.items[0]);
|
||||
}
|
||||
// async 100ms to wait for `select` to get called from `_itemActivate`
|
||||
}, 100);
|
||||
// async 1ms to wait for `select` to get called from `_itemActivate`
|
||||
}, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -289,12 +293,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
* @param {KeyboardEvent} event A keyboard event.
|
||||
*/
|
||||
_onKeydown: function(event) {
|
||||
if (this.keyboardEventMatchesKeys(event, 'up down esc')) {
|
||||
return;
|
||||
if (!this.keyboardEventMatchesKeys(event, 'up down esc')) {
|
||||
// all other keys focus the menu item starting with that character
|
||||
this._focusWithKeyboardEvent(event);
|
||||
}
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
// all other keys focus the menu item starting with that character
|
||||
this._focusWithKeyboardEvent(event);
|
||||
// override _activateHandler
|
||||
_activateHandler: function(event) {
|
||||
Polymer.IronSelectableBehavior._activateHandler.call(this, event);
|
||||
event.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
<!DOCTYPE html><!--
|
||||
@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
|
||||
|
@ -7,9 +6,7 @@ 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
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
--><html><head>
|
||||
|
||||
<title>iron-menu-behavior tests</title>
|
||||
|
||||
|
@ -23,13 +20,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<body>
|
||||
|
||||
<script>
|
||||
|
||||
WCT.loadSuites([
|
||||
'iron-menu-behavior.html',
|
||||
'iron-menubar-behavior.html'
|
||||
'iron-menubar-behavior.html',
|
||||
'iron-menu-behavior.html?dom=shadow',
|
||||
'iron-menubar-behavior.html?dom=shadow'
|
||||
]);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
</body></html>
|
||||
|
|
|
@ -17,8 +17,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
<link rel="import" href="test-menu.html">
|
||||
|
||||
</head>
|
||||
|
@ -44,6 +46,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
|
||||
<test-fixture id="nested">
|
||||
<template>
|
||||
<test-menu>
|
||||
<test-menu>
|
||||
<div>item 1</div>
|
||||
<div>item 2</div>
|
||||
<div>item 3</div>
|
||||
</test-menu>
|
||||
</test-menu>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
|
||||
suite('menu a11y tests', function() {
|
||||
|
@ -96,6 +111,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
}, 200);
|
||||
});
|
||||
|
||||
test('keyboard events should not bubble', function(done) {
|
||||
var menu = fixture('nested');
|
||||
var keyCounter = 0;
|
||||
|
||||
menu.addEventListener('keydown', function(event) {
|
||||
if (menu.keyboardEventMatchesKeys(event, 'esc')) {
|
||||
keyCounter++;
|
||||
}
|
||||
if (menu.keyboardEventMatchesKeys(event, 'up')) {
|
||||
keyCounter++;
|
||||
}
|
||||
if (menu.keyboardEventMatchesKeys(event, 'down')) {
|
||||
keyCounter++;
|
||||
}
|
||||
});
|
||||
|
||||
// up
|
||||
MockInteractions.keyDownOn(menu.firstElementChild, 38);
|
||||
// down
|
||||
MockInteractions.keyDownOn(menu.firstElementChild, 40);
|
||||
// esc
|
||||
MockInteractions.keyDownOn(menu.firstElementChild, 27);
|
||||
|
||||
setTimeout(function() {
|
||||
assert.equal(menu.firstElementChild.tagName, 'TEST-MENU');
|
||||
assert.equal(keyCounter, 0);
|
||||
done();
|
||||
}, 200);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue