PSA: Updated UI for the chrome.sidePanel API

已查看 1,050 次
跳至第一个未读帖子

Oliver Dunk

未读,
2024年5月9日 09:19:285月9日
收件人 Chromium Extensions
Hi all,

TLDR: If your extension uses a side panel, you may need to change how you onboard users and ensure you provide an explicit way for the panel to be opened.

Recently we made some changes to the side panel UI in Chrome. This included adding a pin icon providing an additional way for users to pin an extension’s action icon. This allows users to more easily re-open the side panel if it has been linked to the action icon using either the chrome.sidePanel.setPanelBehavior() or chrome.sidePanel.open() APIs.

We have also removed the global side panel icon, which could be used to access any side panel. Since all side panels were accessed in the same way, users saw all panels as a single feature and expected a consistent experience between them. For our built-in panels (such as Search and Reading List) we want to provide a unique experience requiring more flexibility. We believe the same philosophy makes sense for side panels provided by extensions.

Before making this change, we looked at the extensions using the side panel today. We saw that almost all provide other ways for the side panel to be accessed already. Regardless, we’re very open to feedback if there are situations we missed where this had an impact.

We’ve updated our documentation and samples to reflect this change. If there are any additional questions, please do let us know.

Thanks,
Oliver on behalf of Chrome Extensions DevRel

Rajat Paharia

未读,
2024年5月9日 11:35:545月9日
收件人 Chromium Extensions、Oliver Dunk
I like that extensions are no longer mixed in with the Google products in one sidepanel, that always seemed weird. And I couldn't imagine anyone using that dropdown to switch between functions. 

Thanks for the update Oliver!

datta...@gmail.com

未读,
2024年5月16日 05:33:105月16日
收件人 Chromium Extensions、Rajat Paharia、Oliver Dunk
It’s nice to know that side panels aren't going away completely. Few things that I noticed that can be improved, but I don't know if it's worth filing new issues on issues.chromium.org, so going to leave them here:
1. Some apps might benefit from knowing whether the panel is on the left or right side of the screen. My use case: I want to show a different button icon inside the panel depending on where it's located.
2. Also, please consider making `chrome.management.onEnabled` available without the management permission. It's needed, because when enabling an extension, neither `onInstall` nor `chrome.tabs.onUpdated` (for already opened tabs) gets called (this is where I enable or disable the panel with `setOptions`), so when you open the side panel, it stays open in all tabs. Asking for such dangerous permission as "management" just for the `onEnabled` event is not a viable solution.

Oliver Dunk

未读,
2024年5月16日 06:13:415月16日
收件人 datta...@gmail.com、Chromium Extensions、Rajat Paharia
Thanks for the feedback!

Some apps might benefit from knowing whether the panel is on the left or right side of the screen. My use case: I want to show a different button icon inside the panel depending on where it's located.

This is something I have on the list of requests we've heard. There aren't any plans to implement it at the moment, but definitely good to hear more interest.

Also, please consider making `chrome.management.onEnabled` available without the management permission. It's needed, because when enabling an extension, neither `onInstall` nor `chrome.tabs.onUpdated` (for already opened tabs) gets called

We've actually been discussing a new `chrome.runtime.onEnabled` for this - you can +1 the bug here. In the meantime, I believe we always start up the service worker when an extension is enabled. Could you have some logic to notice that and handle it? You can store a flag in `chrome.storage.session` like "enabled-already" to avoid running the logic more than once. That flag will automatically be cleared when the extension is disabled.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

lettuceleaf

未读,
2024年5月16日 07:39:165月16日
收件人 Chromium Extensions、Oliver Dunk、Chromium Extensions、Rajat Paharia、datta...@gmail.com
Could you have some logic to notice that and handle it? You can store a flag in `chrome.storage.session` like "enabled-already" to avoid running the logic more than once.

Thanks so much for the suggestion, I tried it and it completely solves the problem.

Oliver Dunk

未读,
2024年5月16日 07:59:265月16日
收件人 lettuceleaf、Chromium Extensions、Rajat Paharia
That's great to hear! Glad I could help.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

回复全部
回复作者
转发
0 个新帖子