Initial tabs.hide() warning dialog

I am working on a new addon that makes use of tabs.hide() and in the documentation (tabs.hide() - Mozilla | MDN) it states “The first time an extension hides a tab, the browser will tell the user that the tab is being hidden, show them how they can access the hidden tab, and give them the option of disabling the extension instead.”

In my addon, I allow the user to enter some search parameters and from there hide tabs that don’t meet those criteria. When the user enters the first letter (using my, what I am calling, real-time mode) I see that Firefox generates the informational dialog. However, it is displayed under my popup.html and the text is not fully seen and I could certainly see adding additional options which will make my popup.html large enough to cover the dialog.

There doesn’t seem to be a way (with a little searching around) to be able to force this dialog for “approval” until the first time a tab is hidden. The other information that might complicate this scenario is that once I click off of my popup.html, I restore all tabs to be visible as it is intended to only help find tabs and not permanent. (So once I click off of popup.html, tabs are restored, and the Firefox dialog also goes away.)

Any thoughts on how I might help “expose” this first time dialog better? (I’m thinking maybe just force hiding a tab before popup.html is displayed which would cause the Firefox dialog, but not sure how I would determine when they approved it and should continue with the regular UI … seems fairly complicated.)

Sounds like a variant of this bug:

My workaround has been to close the popup after requesting new permission.
But in your case, it’s a bit harder since you can’t tell whether user approved it already or not :slight_smile: .

It is definitely related. I played around with it more last night and I think the compromise at this point is that my addon will simply hide and then show the last tab in their window to force showing the permission dialog from Firefox. Once they accept the Firefox dialog, the user can disable this startup behavior. (I’ve also added a separate HTML file to be opened if they click on the “info” button explaining the situation)

Hard-coding hiding and showing of last tab on start up will allow prompt to show without any conflict with popup.html

New option to disable this initial behavior.

However, the user does not have to click “Keep Tabs Hidden” or “Disable Extension”. They can simply click off of dialog and it could potentially still come up each time the addon tries to hide a tab which will show the original problem. If they had to choose one of the options and not just dismiss the dialog, this would solve much of the problem and would only happen one time. Even better would be that this dialog would be shown after the addon is installed rather than the first time a tab is hidden.

1 Like

I’ve opened 1964491 - Imporove behavior of tabHide permission in response to this thread.

2 Likes