Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggling of sidebar doesn't always work due to Firefox API limitations #134

Closed
Croydon opened this issue Nov 2, 2017 · 7 comments
Closed

Comments

@Croydon
Copy link
Owner

Croydon commented Nov 2, 2017

Toggling of the sidebar via VTR icon is unreliable, due to limitations in Firefox WebExtension APIs.

  • Firefox should add a function to be able to read the state (open, closed) of the extension sidebar in the current window
  • It's possible to manually workaround this for some cases
    • by keeping manually track of the status
    • however, this is not reliable since there are serveral ways to open/close the sidebar, which doesn't fire any listenable events
      • which means the manually keept sidebar status is wrong now

Not only VTR, but also other add-ons like Tree Style Tab (and every other add-on, which wants to have a sidebar toggling feature via icon (browseraction is the API term)) is affected.

@ntninja
Copy link

ntninja commented Nov 4, 2017

Hi! Just read this issue and realized that I had a similar issue in my extension User Agent Switcher: I needed to know (from the background script) when the user closed the browserAction popup, so that I could delay applying some settings.

My solution was this:

  • Use browser.runtime.onConnect in background page to listen for connections
  • When popup menu is opened:
    • Run script that calls browser.runtime.connect() and sends a message to background to stop applying storage updates (or in your case simply saying "I'm here")
  • When connection and message from popup menu / sidebar panel is recieved in background page:
    • Add listener for onDisconnect to port and assume that the foreground page went away when that event is triggered

On startup it is probably safe to assume that the sidebar panel is not being displayed: If it is it will be immedately be loaded and then open its connection to the background page.

@Croydon
Copy link
Owner Author

Croydon commented Jan 18, 2018

https://bugzilla.mozilla.org/show_bug.cgi?id=1427431 is fixed now in FF59

@Croydon
Copy link
Owner Author

Croydon commented Mar 18, 2018

I still can't seem to use browser.sidebarAction.isOpen within a browserAction.onClicked listener as this adds complexity which leads the browserAction do not get counted as "user input" anymore, which prevents the call of browser.sidebarAction.open and browser.sidebarAction.close.

@Croydon Croydon modified the milestones: 0.10.0, 0.11.0 Mar 27, 2018
@Croydon
Copy link
Owner Author

Croydon commented Apr 8, 2018

@Croydon
Copy link
Owner Author

Croydon commented Apr 8, 2018

My request got denied. I'm going to workaround this in a stupid way.

@Croydon
Copy link
Owner Author

Croydon commented Apr 8, 2018

Implemented as suggested by @Alexander255. Thanks!

@Croydon
Copy link
Owner Author

Croydon commented Apr 12, 2018

Follow up issue: #180

@ghost ghost removed the org:in progress label Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants