Skip to content

Add keyboard shortcuts for searching expense reports and for jumping to a report's policy#92064

Open
iwiznia wants to merge 4 commits into
mainfrom
ionatan_addkeyboardshortcuts
Open

Add keyboard shortcuts for searching expense reports and for jumping to a report's policy#92064
iwiznia wants to merge 4 commits into
mainfrom
ionatan_addkeyboardshortcuts

Conversation

@iwiznia
Copy link
Copy Markdown
Contributor

@iwiznia iwiznia commented May 29, 2026

Explanation of Change

Context https://expensify.slack.com/archives/C03U7DCU4/p1780048986882969

OldDot had SHIFT+P and SHIFT+G, but since we are a chat, in almost every page you are typing that needs to type in the chat input, so using SHIFT for shortcuts is no good (all shortcuts we have use CMD except for SHIFT+ESC because that does not type anything under normal circumstances).
I picked CMD+B and CMD+U because they do not trigger any default browser shortcut.

Tests

  • Press CMD+U, check search popup is shown and prepopulated with type:expense-report report-id:
  • Enter a reportID and check it takes you to a search with that specific report in the list
  • Open the report, press CMD+B check it takes you to the workspace page of that report
  • Press CMD+J check the shortcuts are listed there

Offline tests

No

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

Same as tests

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-05-29.at.12.58.37.PM.mov

@iwiznia iwiznia self-assigned this May 29, 2026
@OSBotify
Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 98cca264500..92292c975be 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -7891,7 +7891,7 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
             copy: 'Kommentar kopieren',
             openDebug: 'Testeinstellungen öffnen',
             expenseReportSearch: 'Spesenberichte suchen',
-            goToWorkspace: 'Zum Arbeitsbereich des aktuellen Berichts wechseln',
+            goToWorkspace: 'Zum Workspace des aktuellen Berichts gehen',
         },
     },
     guides: {
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 8093d20fa64..2de699be44d 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -2814,9 +2814,9 @@ ${amount} pour ${merchant} - ${date}`,
         title: 'Modifier l’agent',
         agentName: 'Nom de l’agent',
         instructions: 'Écrire des instructions personnalisées',
-        chatWithAgent: 'Discuter avec l\u2019agent',
+        chatWithAgent: 'Discuter avec l’agent',
         copilotIntoAccount: 'Copilote dans le compte',
-        deleteAgent: 'Supprimer l\u2019agent',
+        deleteAgent: 'Supprimer l’agent',
         deleteAgentTitle: 'Supprimer l’agent ?',
         deleteAgentMessage: 'Voulez-vous vraiment supprimer cet agent ? Cette action est irréversible.',
     },
@@ -2979,7 +2979,7 @@ ${amount} pour ${merchant} - ${date}`,
         phoneOrEmail: 'Téléphone ou e-mail',
         error: {
             agentSignInBlocked:
-                'Les comptes d\u2019agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
+                'Les comptes d’agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
             invalidFormatEmailLogin: 'L’adresse e-mail saisie est invalide. Veuillez corriger le format et réessayer.',
         },
         cannotGetAccountDetails: 'Impossible de récupérer les détails du compte. Veuillez essayer de vous reconnecter.',
@@ -7920,8 +7920,8 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
             newChat: 'Nouvel écran de discussion',
             copy: 'Copier le commentaire',
             openDebug: 'Ouvrir la boîte de dialogue des préférences de test',
-            expenseReportSearch: 'Rechercher des rapports de dépenses',
-            goToWorkspace: "Accéder à l'espace de travail du rapport actuel",
+            expenseReportSearch: 'Rechercher des notes de frais',
+            goToWorkspace: "Aller à l'espace de travail de la note de frais actuelle",
         },
     },
     guides: {
diff --git a/src/languages/it.ts b/src/languages/it.ts
index e8d10fd8400..d3db750a398 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -2802,8 +2802,8 @@ ${amount} per ${merchant} - ${date}`,
         title: 'Modifica agente',
         agentName: 'Nome agente',
         instructions: 'Scrivi istruzioni personalizzate',
-        chatWithAgent: 'Chatta con l\u2019agente',
-        copilotIntoAccount: 'Copilot nell\u2019account',
+        chatWithAgent: 'Chatta con l’agente',
+        copilotIntoAccount: 'Copilot nell’account',
         deleteAgent: 'Elimina agente',
         deleteAgentTitle: 'Eliminare agente?',
         deleteAgentMessage: 'Sei sicuro di voler eliminare questo agente? Questa azione non può essere annullata.',
@@ -7878,8 +7878,8 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
             newChat: 'Nuova schermata chat',
             copy: 'Copia commento',
             openDebug: 'Apri la finestra delle preferenze di test',
-            expenseReportSearch: 'Cerca report spese',
-            goToWorkspace: "Vai all'area di lavoro del report corrente",
+            expenseReportSearch: 'Cerca i report spese',
+            goToWorkspace: 'Vai allo spazio di lavoro del report corrente',
         },
     },
     guides: {
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index a10d8e18326..4bf4925200a 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -7787,7 +7787,7 @@ ${reportName}
             copy: 'コメントをコピー',
             openDebug: 'テスト設定ダイアログを開く',
             expenseReportSearch: '経費レポートを検索',
-            goToWorkspace: '現在のレポートのワークスペースへ移動',
+            goToWorkspace: '現在のレポートのワークスペースに移動',
         },
     },
     guides: {
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 07911cca35e..992da0207f6 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -7848,7 +7848,7 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
             newChat: 'Nieuw chatscherm',
             copy: 'Opmerking kopiëren',
             openDebug: 'Dialoogvenster testvoorkeuren openen',
-            expenseReportSearch: 'Onkostenrapporten zoeken',
+            expenseReportSearch: 'Onkostendeclaraties zoeken',
             goToWorkspace: 'Ga naar de werkruimte van het huidige rapport',
         },
     },
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 3e0a62a4e5b..d73488cbc75 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -7838,8 +7838,8 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
             newChat: 'Nowy ekran czatu',
             copy: 'Skopiuj komentarz',
             openDebug: 'Otwórz okno preferencji testowania',
-            expenseReportSearch: 'Wyszukaj raporty wydatków',
-            goToWorkspace: 'Przejdź do obszaru roboczego bieżącego raportu',
+            expenseReportSearch: 'Szukaj raportów wydatków',
+            goToWorkspace: 'Przejdź do przestrzeni roboczej bieżącego raportu',
         },
     },
     guides: {
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 4e6c09f1d12..619820eb1db 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -7840,8 +7840,8 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
             newChat: 'Nova tela de chat',
             copy: 'Copiar comentário',
             openDebug: 'Abrir caixa de diálogo de preferências de teste',
-            expenseReportSearch: 'Pesquisar relatórios de despesas',
-            goToWorkspace: 'Ir para o espaço de trabalho do relatório atual',
+            expenseReportSearch: 'Buscar relatórios de despesas',
+            goToWorkspace: 'Ir para o workspace do relatório atual',
         },
     },
     guides: {
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 0059816e537..fbe1e28f549 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -7640,8 +7640,8 @@ ${reportName}
             newChat: '新聊天界面',
             copy: '复制评论',
             openDebug: '打开测试首选项对话框',
-            expenseReportSearch: '搜索费用报告',
-            goToWorkspace: '前往当前报告的工作区',
+            expenseReportSearch: '搜索报销报告',
+            goToWorkspace: '前往当前报表的工作区',
         },
     },
     guides: {

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@iwiznia iwiznia marked this pull request as ready for review May 29, 2026 11:11
@iwiznia iwiznia requested review from a team as code owners May 29, 2026 11:11
@melvin-bot melvin-bot Bot requested review from cead22 and heyjennahay and removed request for a team May 29, 2026 11:11
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 29, 2026

@cead22 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 331d49bfe3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/CONST/index.ts
[PLATFORM_OS_MACOS]: {input: 'u', modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: 'u', modifierFlags: keyModifierCommand},
},
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark new navigation shortcuts as navigation

These two new shortcuts open another UI or navigate to a workspace, but unlike SEARCH/NEW_CHAT they are not tagged with type: CONST.KEYBOARD_SHORTCUTS_TYPES.NAVIGATION_SHORTCUT. The Plaid connection flows explicitly block only shortcuts with that type (see the shortcutsToBlock filter in AddPlaidBankAccount and the Plaid connection steps), so during a Plaid flow Ctrl/Cmd+U can open search and Ctrl/Cmd+B can navigate away instead of being suppressed, interrupting the bank/card linking flow.

Useful? React with 👍 / 👎.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 93.84% <ø> (ø)
...rc/components/Search/SearchRouter/SearchRouter.tsx 46.96% <100.00%> (+0.81%) ⬆️
...on/AppNavigator/KeyboardShortcutsHandler/index.tsx 100.00% <ø> (ø)
...rc/pages/settings/DynamicKeyboardShortcutsPage.tsx 0.00% <ø> (ø)
...onents/Search/SearchRouter/SearchRouterContext.tsx 60.78% <85.71%> (+3.00%) ⬆️
...ardShortcutsHandler/ExpenseReportSearchHandler.tsx 80.00% <80.00%> (ø)
.../KeyboardShortcutsHandler/GoToWorkspaceHandler.tsx 55.55% <55.55%> (ø)
... and 12 files with indirect coverage changes

@iwiznia iwiznia mentioned this pull request May 29, 2026
49 tasks
@cead22 cead22 requested a review from truph01 May 29, 2026 18:10
const {openSearchRouter} = useSearchRouterActions();
const shouldShowRequire2FAPage = useShouldShowRequire2FAPage();

useEffect(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The effect subscribes once with [] deps but the callback captures shouldShowRequire2FAPage from the initial render. If this value changes to true after mount, the keyboard shortcut handler still uses the stale false value and would navigate during the 2FA requirement page.

We can consider using this:

const shouldShowRequire2FAPageRef = useRef(shouldShowRequire2FAPage);
useEffect(() => {
    shouldShowRequire2FAPageRef.current = shouldShowRequire2FAPage;
}, [shouldShowRequire2FAPage]);

if (!reportID) {
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need

if (Navigation.isOnboardingFlow() || shouldShowRequire2FAPage) {
    return;
}

here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants