Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Unified Diff: ui/webui/resources/js/cr/ui/list_selection_controller.js

Issue 2104103002: Convert Event#keyIdentifier (deprecated) to Event#key (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch file manager test Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/js/cr/ui/focus_row.js ('k') | ui/webui/resources/js/cr/ui/menu.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/list_selection_controller.js
diff --git a/ui/webui/resources/js/cr/ui/list_selection_controller.js b/ui/webui/resources/js/cr/ui/list_selection_controller.js
index 9b840d0edd7d1de086f35f79f2181b3d62b49bb7..b2a7abf580dc86646c0f1de61dd888d3d1124910 100644
--- a/ui/webui/resources/js/cr/ui/list_selection_controller.js
+++ b/ui/webui/resources/js/cr/ui/list_selection_controller.js
@@ -177,7 +177,6 @@ cr.define('cr.ui', function() {
* @param {Event} e The keydown event.
*/
handleKeyDown: function(e) {
- var SPACE_KEY_CODE = 32;
var tagName = e.target.tagName;
// If focus is in an input field of some kind, only handle navigation keys
// that aren't likely to conflict with input interaction (e.g., text
@@ -186,10 +185,10 @@ cr.define('cr.ui', function() {
var inputType = e.target.type;
// Just protect space (for toggling) for checkbox and radio.
if (inputType == 'checkbox' || inputType == 'radio') {
- if (e.keyCode == SPACE_KEY_CODE)
+ if (e.key == ' ')
return;
// Protect all but the most basic navigation commands in anything else.
- } else if (e.keyIdentifier != 'Up' && e.keyIdentifier != 'Down') {
+ } else if (e.key != 'ArrowUp' && e.key != 'ArrowDown') {
return;
}
}
@@ -210,8 +209,7 @@ cr.define('cr.ui', function() {
return;
}
- // Space
- if (e.keyCode == SPACE_KEY_CODE) {
+ if (e.key == ' ') {
if (leadIndex != -1) {
var selected = sm.getIndexSelected(leadIndex);
if (e.ctrlKey || !selected) {
@@ -221,27 +219,27 @@ cr.define('cr.ui', function() {
}
}
- switch (e.keyIdentifier) {
+ switch (e.key) {
case 'Home':
newIndex = this.getFirstIndex();
break;
case 'End':
newIndex = this.getLastIndex();
break;
- case 'Up':
+ case 'ArrowUp':
newIndex = leadIndex == -1 ?
this.getLastIndex() : this.getIndexAbove(leadIndex);
break;
- case 'Down':
+ case 'ArrowDown':
newIndex = leadIndex == -1 ?
this.getFirstIndex() : this.getIndexBelow(leadIndex);
break;
- case 'Left':
+ case 'ArrowLeft':
case 'MediaPreviousTrack':
newIndex = leadIndex == -1 ?
this.getLastIndex() : this.getIndexBefore(leadIndex);
break;
- case 'Right':
+ case 'ArrowRight':
case 'MediaNextTrack':
newIndex = leadIndex == -1 ?
this.getFirstIndex() : this.getIndexAfter(leadIndex);
« no previous file with comments | « ui/webui/resources/js/cr/ui/focus_row.js ('k') | ui/webui/resources/js/cr/ui/menu.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698