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

Unified Diff: ui/webui/resources/js/cr/ui/command.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
Index: ui/webui/resources/js/cr/ui/command.js
diff --git a/ui/webui/resources/js/cr/ui/command.js b/ui/webui/resources/js/cr/ui/command.js
index 8663a373bdf8dd4b440edc2f62918c2ae86ae15f..ec967796e4157971e2432f6b575ac13862dd2998 100644
--- a/ui/webui/resources/js/cr/ui/command.js
+++ b/ui/webui/resources/js/cr/ui/command.js
@@ -26,7 +26,7 @@ cr.define('cr.ui', function() {
function KeyboardShortcut(shortcut) {
var mods = {};
var ident = '';
- shortcut.split('-').forEach(function(part) {
+ shortcut.split('|').forEach(function(part) {
var partLc = part.toLowerCase();
switch (partLc) {
case 'alt':
@@ -53,7 +53,7 @@ cr.define('cr.ui', function() {
* @return {boolean} Whether we found a match or not.
*/
matchesEvent: function(e) {
- if (e.keyIdentifier == this.ident_) {
+ if (e.key == this.ident_) {
// All keyboard modifiers needs to match.
var mods = this.mods_;
return ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].every(function(k) {
@@ -114,17 +114,17 @@ cr.define('cr.ui', function() {
/**
* The keyboard shortcut that triggers the command. This is a string
- * consisting of a keyIdentifier (as reported by WebKit in keydown) as
- * well as optional key modifiers joinded with a '-'.
+ * consisting of a key (as reported by WebKit in keydown) as
+ * well as optional key modifiers joinded with a '|'.
*
* Multiple keyboard shortcuts can be provided by separating them by
* whitespace.
*
* For example:
* "F1"
- * "U+0008-Meta" for Apple command backspace.
- * "U+0041-Ctrl" for Control A
- * "U+007F U+0008-Meta" for Delete and Command Backspace
+ * "Backspace|Meta" for Apple command backspace.
+ * "a|Ctrl" for Control A
+ * "Delete Backspace|Meta" for Delete and Command Backspace
*
* @type {string}
*/
« no previous file with comments | « ui/webui/resources/js/cr/ui/autocomplete_list.js ('k') | ui/webui/resources/js/cr/ui/context_menu_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698