-
Notifications
You must be signed in to change notification settings - Fork 56
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
Proposal: extend extend browser.action API to display popup in the middle of the screen #307
Comments
I really like this! I recently opened an issue about a more reliable way to draw over web content and it would be nice to see if we could tackle both issues at once: #235 They do feel slightly different in the level of access they want to the page though. #235 would benefit from being controlled by the content script, whereas this use case seems like it would benefit from being able to run on pages even without host permissions. |
Is this the same like below?
I created a proposal #267 like your proposal but put the popup in a new tab.
But they don't like the proposal if it is easy to do with existing api. |
Yes, exactly. Also, content scripts can't run on restricted pages. In Chrome, for example, that would be the new tab page (and all |
If it is the middle of the browser window, use The window |
@hanguokai I apologize, I removed my comment soon after posting it, as I misunderstood what you were saying.
Thank you for sharing, I didn't know about the "popup" window type. This API has a different set of issues:
If I were to reimplement something like Omni, having the title bar would look unnecessary and antiquated.
|
It seems like either could work.
No, not in my case. |
I generally understand your idea, and I also want to have this feature, but if I think about it, it's complicated.
|
I do like this proposal. |
1-3: Yes. |
I get not wanting to have the window titlebar, but there has to be some consistent and accessible way for the user to close the popup, even if the nefarious extension developer doesn't want it to be closed. Perhaps hovering over the background scrim would always show a close box somewhere.
I've worked around this by keeping the popup open persistently. Command shortcuts can bring it forward when needed. The hard part is hiding the window. Moving it off-screen used to work on Windows in earlier versions of Chrome, but not on macOS. I've resorted to having options to hide it behind the current window, move it to/from a tab, or minimize it (which can also be slow, depending on the OS and whether animations are enabled). |
Another use case for my proposal is to be able to re-implement Arc's "new tab" UI as a browser extension:
I updated my top comment with an alternative proposal — "Option 2". Please check it out. @fwextensions, I appreciate the tips/hacks (I wasn't aware of them), but it would be even better not to rely on the off-screen window at all. |
None of the browser vendors supported this API proposal, so I'm closing this. As per our discussion below, I opened #347.
|
I propose to extend chrome.action API to allow displaying popup in the middle of the browser screen, instead of the top right corner.
Existing extensions, such as Omni, inject a content script on every single website only to display a popup in the middle of the screen.
This is bad for several reasons: excessive permissions, doesn't work at all on the new tab page (and the rest internal browser pages), the popup code can break the website, and the website code can break the popup.
Option 1
This would center the popup in the middle both vertically and horizontally.
Option 2
Extend the existing OpenPopupOptions of browser.action.openPopup(options).
When
top
andleft
are specified, the popup is no longer anchored to the extension icon.top
andleft
is the offset from the top left corner of the screen in pixels. The same way it works for Window'stop
andleft
already.Security concerns:
Outdated message:
The existing popup has a slight shadow (on macOS at least; OS-specific), but it might now be sufficient. To solve this, I suggest that browsers "fade out" the rest of the UI while the positioned popup is visible. Chrome and Safari already do this with modal dialogs:
Minor details:
top
is specified, but notleft
(or vice-versa)? We can throw an exception and/or display the popup as if bothtop
andleft
weren't specified.Related docs:
browser.action.openPopup on MDN
chrome.action.openPopup
What about mobile or tablets?
On mobile devices, I don't expect this to make any difference.
On tablets, I think this should behave the same way as on the desktop. (I'd like to hear more from the browser vendors.)
Related docs: MDN, Chrome.
The text was updated successfully, but these errors were encountered: