Closed Bug 1931511 Opened 3 months ago Closed 2 months ago

Close sidebar or popup (addons)

Categories

(WebExtensions :: General, defect)

Firefox 133
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mprops, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0

Steps to reproduce:

I notice that now on FF 133 b8 that window.close() also affects the sidebar now, it closes the sidebar. It used to be that it would ignore the sidebar, and apply only to popups. So I built based on that.

Actual results:

However now window.close() closes the sidebar, as well as the popup, so now my extension needs to adapt.

Expected results:

How can I either detect if it's a sidebar or a popup, to know what to do depending on which. Or, how can I close selectively only the sidebar, or only the popup, programmatically?

The Bugbug bot thinks this bug should belong to the 'Firefox::Sidebar' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Sidebar

On element I got this answer which I guess fixes the issue:

f you are re-using the HTML document, you could still append a query string or reference fragment after the file name, e.g. ?popup and ?sidebar to distinguish the two, and use location.search to look up that value

(In reply to mprops from comment #2)

On element I got this answer which I guess fixes the issue:

f you are re-using the HTML document, you could still append a query string or reference fragment after the file name, e.g. ?popup and ?sidebar to distinguish the two, and use location.search to look up that value

So it the issue fixed?

Flags: needinfo?(mprops)

As long as I can discern between popup and sidebar it is fixed for me. So right now it's fixed, even if the solution is a bit hacky, and hopefully not prone to be removed in the future (appending ?popup/?sidebar).

Flags: needinfo?(mprops)

(In reply to mprops from comment #2)

On element I got this answer which I guess fixes the issue:

f you are re-using the HTML document, you could still append a query string or reference fragment after the file name, e.g. ?popup and ?sidebar to distinguish the two, and use location.search to look up that value

Hi, is this from documentation for the extension sidebar API? A link would be helpful here, as it seems like something might need to be updated?

Flags: needinfo?(mprops)

Btw it's missing the first letter it's "If you are" etc.

Probably not in the documentation. I got this from a user in the matrix, addons channel.

This should be documented somewhere in the addons pages.

Flags: needinfo?(mprops)

Sending this over to addons team as it sounds like something might need to be updated.

mprops, could you better explain what you're trying to do with your extension. Maybe a screenshot or screencast would help as the issue is a bit vague (what has changed and how exactly its affecting your extension).

Component: Sidebar → General
Product: Firefox → WebExtensions
Flags: needinfo?(mprops)

Hello mprops !

Would you mind attaching a test extension so I can try and confirm this issue? Thank you !

Closing the sidebar when window.close() is called is intentional. We haven't documented the change, but we should.

(In reply to mprops from comment #0)

How can I either detect if it's a sidebar or a popup, to know what to do depending on which. Or, how can I close selectively only the sidebar, or only the popup, programmatically?

If you want to reuse the HTML page, you can add a query string to the popup/sidebar definition, e.g. panel.html?sidebar, and use location.search and/or URLSearchParams to parse the URL from your script.

Status: UNCONFIRMED → RESOLVED
Closed: 2 months ago
Flags: needinfo?(mprops)
Resolution: --- → WONTFIX
See Also: → 1921631
You need to log in before you can comment on or make changes to this bug.