Detect if Side Panel is Open on Left/Right

173 views
Skip to first unread message

Jack Crane

unread,
Jul 30, 2024, 3:09:35 PMJul 30
to Chromium Extensions
From a Chrome Extension, is there a way to detect if the Chrome Side Panel is open on the left or right?

woxxom

unread,
Jul 31, 2024, 9:10:12 AMJul 31
to Chromium Extensions, Jack Crane
AFAICT, there's no reliable method in Chrome due to https://crbug.com/40281264.

When it's fixed, you'll compare window.screenX to (await chrome.windows.getCurrent()).left inside the side panel.
For now though you'll have to obtain window.screenX from a content script running in any tab of this window.

Another workaround is to use event.screenX in a listener for mouseover event that's triggered by the user, which is not guaranteed to occur at all.

You can suggest implementing a proper API and a notification event for the change in https://github.com/w3c/webextensions/issues/

Reply all
Reply to author
Forward
0 new messages