PSA: Updated UI for the chrome.sidePanel API

1,017 צפיות
מעבר להודעה הראשונה שלא נקראה

Oliver Dunk

לא נקראה,
9 במאי 2024, 9:19:289 במאי
עד 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

לא נקראה,
9 במאי 2024, 11:35:549 במאי
עד 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

לא נקראה,
16 במאי 2024, 5:33:1016 במאי
עד 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

לא נקראה,
16 במאי 2024, 6:13:4116 במאי
עד 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

לא נקראה,
16 במאי 2024, 7:39:1616 במאי
עד 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

לא נקראה,
16 במאי 2024, 7:59:2616 במאי
עד 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 הודעות חדשות