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

Unified Diff: ui/webui/resources/js/cr/ui/menu_item.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/menu_button.js ('k') | ui/webui/resources/js/cr/ui/overlay.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/menu_item.js
diff --git a/ui/webui/resources/js/cr/ui/menu_item.js b/ui/webui/resources/js/cr/ui/menu_item.js
index b4726f282f9d03f47265db2ea55967b13c489e00..bfe7eaac1f5903bb3da92ce4bf172ebac160d306 100644
--- a/ui/webui/resources/js/cr/ui/menu_item.js
+++ b/ui/webui/resources/js/cr/ui/menu_item.js
@@ -143,7 +143,7 @@ cr.define('cr.ui', function() {
var shortcut = shortcuts[0];
var mods = {};
var ident = '';
- shortcut.split('-').forEach(function(part) {
+ shortcut.split('|').forEach(function(part) {
var partUc = part.toUpperCase();
switch (partUc) {
case 'CTRL':
@@ -160,25 +160,19 @@ cr.define('cr.ui', function() {
var shortcutText = '';
- // TODO(zvorygin): if more cornercases appear - optimize following
- // code. Currently 'Enter' keystroke is passed as 'Enter', but 'Space'
- // and 'Backspace' are passed as 'U+0020' and 'U+0008'.
- if (ident == 'U+0020')
- ident = 'Space';
- else if (ident == 'U+0008')
- ident = 'Backspace';
-
['CTRL', 'ALT', 'SHIFT', 'META'].forEach(function(mod) {
if (mods[mod])
shortcutText += loadTimeData.getString('SHORTCUT_' + mod) + '+';
});
- if (ident.indexOf('U+') != 0) {
+ if (ident == ' ')
+ ident = 'Space';
+
+ if (ident.length != 1) {
shortcutText +=
loadTimeData.getString('SHORTCUT_' + ident.toUpperCase());
} else {
- shortcutText +=
- String.fromCharCode(parseInt(ident.substring(2), 16));
+ shortcutText += ident.toUpperCase();
}
this.setAttribute('shortcutText', shortcutText);
« no previous file with comments | « ui/webui/resources/js/cr/ui/menu_button.js ('k') | ui/webui/resources/js/cr/ui/overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698