From 16023ac152f27ec7212dc09cb11f97db5188d215 Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Sun, 4 May 2025 10:25:31 +0300 Subject: [PATCH] fix: clicking action button on firefox doesn't open sidebar --- entrypoints/background.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/entrypoints/background.ts b/entrypoints/background.ts index 7a6176d..bc40ebb 100644 --- a/entrypoints/background.ts +++ b/entrypoints/background.ts @@ -150,13 +150,16 @@ export default defineBackground(() => await browser.action.setTitle({ title: i18n.t(`actions.${defaultAction}.${selection}`) }); }; + const toggleSidebarFirefox = async (): Promise => + await browser.sidebarAction.toggle(); + const updateButton = async (action: SettingsValue<"contextAction">): Promise => { logger("updateButton", action); // Cleanup any existing behavior browser.action.onClicked.removeListener(onClickAction); - browser.action.onClicked.removeListener(browser?.sidebarAction?.toggle); + browser.action.onClicked.removeListener(toggleSidebarFirefox); browser.action.onClicked.removeListener(openCollectionsInTab); await browser.action.disable(); @@ -181,7 +184,7 @@ export default defineBackground(() => if (location === "sidebar") { if (import.meta.env.FIREFOX) - browser.action.onClicked.addListener(browser.sidebarAction.toggle); + browser.action.onClicked.addListener(toggleSidebarFirefox); else chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }); }