Can add-ons/WebExtensions popups determinate whether they are shown in the overflow menu or not?

My simple question is: Can popups if add-ons somehow determinate whether they are shown in the overflow menu (i.e. that grafik) or as a “usual” button in the toolbar, when clicked.

The reason is my add-on wants to set a (max)height on the html/body elements only when shown as a “usual popup”, so the scrollbar when resizing the popup with a large height does not appear, while the same CSS option limits the popup in the overflow menu from getting resized at all.
So basically I’d have to set a CSS property conditionally (via JS, if needed, that would not be a problem).

If you want to know the details of what I want to accomplish, see this issue:

1 Like

They can only try to know based on their viewport, since the width is fixed when in the overflow menu, however height is unlimited or limited similary to a stand alone popup. Note that you’d also want to avoid limiting the height for Android - if you don’t explicitly remove Android support.

Hmm, but can one determinate (preferrably) without resizing the window, to determinate whether a size if fixed in JS?

Yes good point, but I’ll do. The height limit is just height: 100% (and max-height: 100% and overflow: hidden). This prevents the scrollbar without setting a limit in pixels.
However, as said, even this prevents re-sizing the popup in the overflow menu. (whereas it does not when the popup is “alone” not in the overflow menu)

So any idea here?

Is not the width of the HTML part in the overflow menu always fixed to the same size? Could not this be used to determinate the position?

Do @media queries work on the overflow list?

https://developer.mozilla.org/docs/Web/CSS/@media/width

Thanks, yes, of course.

So I fixed that, indeed. The width is, BTW, always 425px as far as I found out.

Can someone maybe point me to the actual Firefox source code, where the (maximum) widths of these popups are set?

Because now I found window.innerWidth = 348 to be the new maxiumum width when testing this again?

I found this, but these are only some tests:
https://searchfox.org/mozilla-central/source/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js

There is a max-width: 348px on .PanelUI-subView in the overflow list that appears to be assigned using a script. However, I don’t know where that comes from.

Well… in my testing it turned out that “348px” seems to be the value used on Windows, while the with on Linux (GNOME) actually is “425px”.

If so, can someone possibly test this on Mac OS?

If you need some test add-on, here is one (actually a lib, but has an example/test add-on included):