Skip to content

feat: add keyboard shortcut to open Cookies modal.#7801

Open
KanhaiyaPandey wants to merge 2 commits intousebruno:mainfrom
KanhaiyaPandey:feat/add-cookies-shortcut
Open

feat: add keyboard shortcut to open Cookies modal.#7801
KanhaiyaPandey wants to merge 2 commits intousebruno:mainfrom
KanhaiyaPandey:feat/add-cookies-shortcut

Conversation

@KanhaiyaPandey
Copy link
Copy Markdown

@KanhaiyaPandey KanhaiyaPandey commented Apr 20, 2026

📝 PR Description

Added a keyboard shortcut to quickly open and close the Cookies modal, improving developer workflow and accessibility.

✨ Changes

  • Introduced default shortcut:
    • Windows/Linux: Shift + Alt + C
    • macOS: Shift + Option + C
  • Shortcut toggles the Cookies modal (open/close)
  • Added support for customizing the shortcut via:
    • Preferences → Keybindings → Cookies → "Open Cookies"

📸 Screenshots

  • Opening Cookies modal using shortcut
Screenshot 2026-04-20 at 3 52 38 PM
  • Keybinding customization in Preferences
Screenshot 2026-04-20 at 3 52 26 PM

🚀 Impact

  • Reduces friction when frequently accessing Cookies
  • Improves keyboard-first navigation
  • Enhances overall developer experience

🔗 Closes

Closes #7799

Summary by CodeRabbit

  • New Features

    • Added a keyboard shortcut to open/close the Cookies modal (Cmd+Shift+C on Mac, Shift+Alt+C on Windows).
  • Improvements

    • Cookies modal is now driven by global app state for consistent behavior.
    • The Cookies button and keyboard shortcut both open/close the same modal state.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 43ee5fcb-abed-4bc4-8e27-a79f790e7911

📥 Commits

Reviewing files that changed from the base of the PR and between fdd18d8 and 4bf9654.

📒 Files selected for processing (1)
  • packages/bruno-app/src/providers/Hotkeys/keyMappings.js

Walkthrough

Keyboard shortcut support for opening the Cookies modal was added. Cookies modal visibility was moved from local React state to Redux (isCookiesModalOpen), new Redux actions were introduced, a keybinding mapping was added, and the Hotkeys provider dispatches the toggle action on shortcut activation.

Changes

Cohort / File(s) Summary
Redux State Management
packages/bruno-app/src/providers/ReduxStore/slices/app.js
Added isCookiesModalOpen to initial state and three actions: openCookiesModal, closeCookiesModal, toggleCookiesModal.
Hotkey Configuration
packages/bruno-app/src/providers/Hotkeys/keyMappings.js
Added Cookies section and openCookies binding (mac: command+bind+shift+bind+c, windows: shift+bind+alt+bind+c) with name "Open Cookies".
Hotkeys Provider
packages/bruno-app/src/providers/Hotkeys/index.js
Bound openCookies action to dispatch toggleCookiesModal() in a useEffect; cleans up binding on unmount.
UI Component Integration
packages/bruno-app/src/components/StatusBar/index.js
Replaced local cookiesOpen state with Redux isCookiesModalOpen; button now dispatches openCookiesModal() and modal onClose dispatches closeCookiesModal().

Sequence Diagram

sequenceDiagram
    actor User
    participant Hotkeys as Hotkeys Provider
    participant Redux as Redux Store
    participant StatusBar as StatusBar Component

    User->>Hotkeys: Press shortcut (Shift+Alt+C / Cmd+Shift+C)
    Hotkeys->>Redux: dispatch(toggleCookiesModal())
    Redux->>Redux: toggle isCookiesModalOpen
    Redux->>StatusBar: state update (isCookiesModalOpen)
    StatusBar->>User: render show/hide Cookies modal
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size/S

Suggested reviewers

  • helloanoop
  • naman-bruno
  • lohit-bruno
  • bijin-bruno

Poem

⌨️ A shortcut hums, a modal wakes,
Redux flips what local state forsakes,
A keypress calls, the UI sings,
Cookies open on swift wings,
Small change — productivity takes 🍪

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding a keyboard shortcut feature for the Cookies modal.
Linked Issues check ✅ Passed The PR fully implements the requirements from #7799: a customizable keyboard shortcut to open the Cookies modal with sensible defaults (Shift+Alt+C for Windows/Linux, Shift+Option+C for macOS).
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the keyboard shortcut feature: Redux state management, hotkey binding, key mapping definitions, and StatusBar modal integration—no extraneous modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/StatusBar/index.js (1)

61-74: ⚠️ Potential issue | 🟡 Minor

Minor: unguarded querySelector(...).focus() can throw.

If the [data-trigger="cookies"] button isn't in the DOM when the modal closes (e.g., StatusBar unmounted, or layout change hides it), document.querySelector(...) returns null and .focus() will throw a TypeError. A tiny guard keeps close robust:

🛡️ Proposed guard
             onClose={() => {
               dispatch(closeCookiesModal());
-              document.querySelector('[data-trigger="cookies"]').focus();
+              document.querySelector('[data-trigger="cookies"]')?.focus();
             }}

Also note: when the modal is closed via the Shift+Alt+C hotkey (which dispatches toggleCookiesModal directly), this onClose doesn't fire, so focus isn't restored in that path. Not blocking, just a small UX inconsistency worth being aware of.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/StatusBar/index.js` around lines 61 - 74,
The onClose handler in the StatusBar's Cookies modal calls
document.querySelector('[data-trigger="cookies"]').focus() without a null check,
which can throw if the trigger isn't present; update the onClose in the Cookies
component (the anonymous function that dispatches closeCookiesModal()) to first
query the element into a variable and only call .focus() if that element exists
(e.g., guard with if (el) or optional chaining), leaving the
dispatch(closeCookiesModal()) behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-app/src/providers/Hotkeys/keyMappings.js`:
- Around line 58-63: The current binding for openCookies in keyMappings.js uses
'shift+bind+alt+bind+c' which maps to shift+option+c on macOS and fails with
Mousetrap 1.6.5 because the browser reports a dead key (ç/Ç); update the
openCookies binding to use a mac-safe shortcut or add platform-specific entries:
change the mac binding to a different modifier+letter that doesn't produce a
dead key (e.g., avoid 'option+c') or add a conditional entry for openCookies
with a mac-safe key, or upgrade/replace Mousetrap with a library that correctly
normalizes modifier+letter combos—target the openCookies binding in the bindings
object to apply the fix.

---

Outside diff comments:
In `@packages/bruno-app/src/components/StatusBar/index.js`:
- Around line 61-74: The onClose handler in the StatusBar's Cookies modal calls
document.querySelector('[data-trigger="cookies"]').focus() without a null check,
which can throw if the trigger isn't present; update the onClose in the Cookies
component (the anonymous function that dispatches closeCookiesModal()) to first
query the element into a variable and only call .focus() if that element exists
(e.g., guard with if (el) or optional chaining), leaving the
dispatch(closeCookiesModal()) behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a1a9bf18-a587-42b5-bfc4-2522e45eace9

📥 Commits

Reviewing files that changed from the base of the PR and between c6281d3 and fdd18d8.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/StatusBar/index.js
  • packages/bruno-app/src/providers/Hotkeys/index.js
  • packages/bruno-app/src/providers/Hotkeys/keyMappings.js
  • packages/bruno-app/src/providers/ReduxStore/slices/app.js

Comment thread packages/bruno-app/src/providers/Hotkeys/keyMappings.js
@tech-dipesh
Copy link
Copy Markdown

Can it be reviewed? If anything feels like it needs to be improved, I can improve, because without a shortcut, I feel too irritated to use the mouse to go over cookies.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Keyboard Shortcut for the see a Cookies

2 participants