Merge "ui: Change search hotkey to '/'" into main
diff --git a/ui/src/base/hotkeys.ts b/ui/src/base/hotkeys.ts
index ea278d1..bb43cec 100644
--- a/ui/src/base/hotkeys.ts
+++ b/ui/src/base/hotkeys.ts
@@ -104,6 +104,27 @@
 type AllowInEditable = '!' | '';
 export type Hotkey = `${AllowInEditable}${Modifier}${Key}`;
 
+// The following list of keys cannot be pressed wither with or without the
+// presence of the Shift modifier on most keyboard layouts. Thus we should
+// ignore shift in these cases.
+const shiftExceptions = [
+  '0',
+  '1',
+  '2',
+  '3',
+  '4',
+  '5',
+  '6',
+  '7',
+  '8',
+  '9',
+  '/',
+  '?',
+  '!',
+  '[',
+  ']',
+];
+
 // Represents a deconstructed hotkey.
 export interface HotkeyParts {
   // The name of the primary key of this hotkey.
@@ -191,7 +212,8 @@
 
   // For certain keys we relax the shift requirement, as they usually cannot be
   // pressed without the shift key on English keyboards.
-  const shiftOk = key.match(/[\?\!]/) || shiftKey === wantShift;
+  const shiftOk =
+    shiftExceptions.includes(key as string) || shiftKey === wantShift;
 
   return (
     metaKey === wantMeta &&
diff --git a/ui/src/frontend/app.ts b/ui/src/frontend/app.ts
index dc65d19..3dea6fd 100644
--- a/ui/src/frontend/app.ts
+++ b/ui/src/frontend/app.ts
@@ -466,7 +466,7 @@
       id: 'perfetto.Search',
       name: 'Search',
       callback: () => this.enterSearchMode(true),
-      defaultHotkey: '!Mod+S',
+      defaultHotkey: '/',
     },
     {
       id: 'perfetto.ShowHelp',
diff --git a/ui/src/frontend/help_modal.ts b/ui/src/frontend/help_modal.ts
index 23f1c32..d08f6e7 100644
--- a/ui/src/frontend/help_modal.ts
+++ b/ui/src/frontend/help_modal.ts
@@ -247,11 +247,7 @@
           m('td', keycap(ctrlOrCmd), ' + ', keycap('o')),
           m('td', 'Run query'),
         ),
-        m(
-          'tr',
-          m('td', keycap(ctrlOrCmd), ' + ', keycap('s')),
-          m('td', 'Search'),
-        ),
+        m('tr', m('td', keycap('/')), m('td', 'Search')),
         m('tr', m('td', keycap('q')), m('td', 'Toggle tab drawer')),
         ...sidebarInstructions,
         m('tr', m('td', keycap('?')), m('td', 'Show help')),