From ef477d0381d0d7c9158a7659cc22427143e5aa90 Mon Sep 17 00:00:00 2001 From: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:31:09 +0100 Subject: [PATCH] feat: Warn when binding browser-reserved shortcuts (#9406) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Show a non-blocking warning in the keybinding edit dialog when users try to bind shortcuts that browsers intercept (e.g. Ctrl+T, Ctrl+W, F12). ## Changes - **What**: Add `RESERVED_BY_BROWSER` set of known browser-intercepted shortcuts, `isBrowserReserved` getter on `KeyComboImpl`, and a warning `` in the keybinding edit dialog. Users can still save the binding. ## Review Focus Whether the list of browser-reserved shortcuts is comprehensive enough, and whether a non-blocking warning (vs blocking) is the right UX choice. ## Before https://github.com/user-attachments/assets/5abfc062-5ed1-4fcd-b394-ff98221d82a8 ## After https://github.com/user-attachments/assets/12a49e24-051f-4579-894a-164dbf1cb7b7 Fixes #1087 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9406-feat-Warn-when-binding-browser-reserved-shortcuts-31a6d73d36508162a021e88ab76914f6) by [Unito](https://www.unito.io) --------- Co-authored-by: Kelly Yang <124ykl@gmail.com> Co-authored-by: Alexander Brown Co-authored-by: Christian Byrne Co-authored-by: jaeone94 <89377375+jaeone94@users.noreply.github.com> Co-authored-by: Benjamin Lu Co-authored-by: Comfy Org PR Bot Co-authored-by: christian-byrne <72887196+christian-byrne@users.noreply.github.com> Co-authored-by: github-actions Co-authored-by: AustinMroz Co-authored-by: GitHub Action Co-authored-by: Terry Jia Co-authored-by: Alexander Brown Co-authored-by: Dante Co-authored-by: Deep Mehta <42841935+deepme987@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 Co-authored-by: Amp Co-authored-by: Jin Yi Co-authored-by: Yourz Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com> --- browser_tests/tests/dialog.spec.ts | 4 +- src/components/bottomPanel/BottomPanel.vue | 18 ++- .../content/setting/KeybindingPanel.vue | 138 +++--------------- .../keybinding/EditKeybindingContent.vue | 56 +++++++ .../keybinding/EditKeybindingFooter.vue | 72 +++++++++ .../keybinding/EditKeybindingHeader.vue | 5 + src/composables/useEditKeybindingDialog.ts | 60 ++++++++ src/locales/en/main.json | 7 +- src/platform/keybindings/keyCombo.test.ts | 39 +++++ src/platform/keybindings/keyCombo.ts | 17 ++- src/platform/keybindings/reserved.ts | 25 ++++ 11 files changed, 308 insertions(+), 133 deletions(-) create mode 100644 src/components/dialog/content/setting/keybinding/EditKeybindingContent.vue create mode 100644 src/components/dialog/content/setting/keybinding/EditKeybindingFooter.vue create mode 100644 src/components/dialog/content/setting/keybinding/EditKeybindingHeader.vue create mode 100644 src/composables/useEditKeybindingDialog.ts create mode 100644 src/platform/keybindings/keyCombo.test.ts diff --git a/browser_tests/tests/dialog.spec.ts b/browser_tests/tests/dialog.spec.ts index 93af2ea673..611c0c3c71 100644 --- a/browser_tests/tests/dialog.spec.ts +++ b/browser_tests/tests/dialog.spec.ts @@ -333,7 +333,7 @@ test.describe('Settings', () => { await editKeybindingButton.click() // Set new keybinding - const input = comfyPage.page.getByPlaceholder('Press keys for new binding') + const input = comfyPage.page.getByPlaceholder('Enter your keybind') await input.press('Alt+n') const requestPromise = comfyPage.page.waitForRequest( @@ -345,7 +345,7 @@ test.describe('Settings', () => { // Save keybinding const saveButton = comfyPage.page - .getByLabel('New Blank Workflow') + .getByLabel('Modify keybinding') .getByText('Save') await saveButton.click() diff --git a/src/components/bottomPanel/BottomPanel.vue b/src/components/bottomPanel/BottomPanel.vue index 08f23c5098..37567ab7e5 100644 --- a/src/components/bottomPanel/BottomPanel.vue +++ b/src/components/bottomPanel/BottomPanel.vue @@ -25,15 +25,13 @@ class: { 'p-3 rounded-lg': true, 'pointer-events-none': - bottomPanelStore.bottomPanelTabs.length === 1 - }, - style: { - color: 'var(--fg-color)', - backgroundColor: + bottomPanelStore.bottomPanelTabs.length === 1, + 'bg-secondary-background text-secondary-foreground': + x.context.active && + bottomPanelStore.bottomPanelTabs.length > 1, + 'text-muted-foreground': !x.context.active || - bottomPanelStore.bottomPanelTabs.length === 1 - ? '' - : 'var(--bg-color)' + bottomPanelStore.bottomPanelTabs.length <= 1 } }) " @@ -127,4 +125,8 @@ const closeBottomPanel = () => { :deep(.p-tablist-active-bar) { display: none; } + +:deep(.p-tab-active) { + color: inherit; +} diff --git a/src/components/dialog/content/setting/KeybindingPanel.vue b/src/components/dialog/content/setting/KeybindingPanel.vue index ffecfd81e1..db48f4d502 100644 --- a/src/components/dialog/content/setting/KeybindingPanel.vue +++ b/src/components/dialog/content/setting/KeybindingPanel.vue @@ -59,7 +59,15 @@ :pt="{ bodyCell: 'p-1 min-h-8' }" > @@ -93,44 +101,6 @@ - -
- - - {{ $t('g.keybindingAlreadyExists') }} - - -
- -