From f2398574eda26925991e8c2ea30ed393c39415aa Mon Sep 17 00:00:00 2001 From: pengx17 Date: Wed, 27 Nov 2024 07:00:45 +0000 Subject: [PATCH] fix(electron): should not show context menu if there is no typos (#8895) fix AF-1794 --- .../apps/electron/src/main/windows-manager/tab-views.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts b/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts index a224f8fbbd3f8..86b387db3361b 100644 --- a/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts +++ b/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts @@ -836,6 +836,12 @@ export class WebContentViewsManager { if (spellCheckSettings.enabled) { view.webContents.on('context-menu', (_event, params) => { + const shouldShow = + params.misspelledWord && params.dictionarySuggestions.length > 0; + + if (!shouldShow) { + return; + } const menu = new Menu(); // Add each spelling suggestion