chrome-extensions-samples: sidePanel does not automatically open

Describe the bug As per both the description in the docs and on the README, the chrome extension cookbook.sidepanel-site-specific should automatically open the sidePanel when navigating to google.com. This does not happen, you have to click the icon.

To Reproduce

  1. Install the extension as unpacked
  2. Go to Google.com

Expected behavior SidePanel to open automatically

Notes The docs specifically point at this example for functionality: https://developer.chrome.com/docs/extensions/reference/sidePanel/#by-site And the README states “This example demonstrates how to display the side panel only on google.com using the Side Panel API” here

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 19 (5 by maintainers)

Most upvoted comments

Thanks all for the feedback. As mentioned, the user gesture requirement is by design and we don’t plan on changing that for now. A lot of thought goes into what Chrome shows when and in this case we want to provide some guiderails.

In the next Chrome release, Chrome 127, we are launching the action.openPopup() API without a user gesture requirement so we do see the value in that more generally. I know as a developer, these limitations can be frustrating. We do try to avoid them when we think it makes sense.

All of the feedback on documentation is appreciated. @lucasjohnston, I’ve just triaged an existing issue to document more clearly what counts as user action: https://issuetracker.google.com/40418577

Going to close this issue since I don’t think there is anything to change in the samples repository, but again, we’re definitely taking notes on everything. Thanks everyone!

Hi @patrickkettner @AmySteam @lucasjohnston, I’ve read your discussion above which was quite helpful. @patrickkettner I am also building up a Chrome extension I think my client can also face this issue. Yet I’ve not discussed with him but I think he’ll say something on this issue.

I am also facing an issue. I want to make sidePanel more wider than its default size. Is there any possibility of doing this? Because I’ve searched a lot but you also have to do it manually. There is no way to handle its size via CSS or any other way or I’m unable to find it yet.

Any suggestions or help will be so much appreciated. Thanks

Warm Regards Abdul Quddous

I want to throw my hat in the ring saying that the lack of ability to have the side panel stay open globally (or the ability for extensions to programmatically open it at will), really makes the side panel useless for a large number of scenarios. As a user, if I had to constantly open it manually all the time, I would just never use it.

As a developer, it’s frustrating too. My use case is that I’m developing an enterprise extension only available to internal employees distributed through our Google Workspace account. We are a web development company so the idea is that it’s a companion to the sites we build. So ideally it would be visible on every page. Users uses lots of tabs and bounce around to different sites a lot. So reopening it frequently is annoying and people just won’t do it and won’t get the benefit from this.

I can see how this could be annoying for users if it went unchecked. So I’d expect this to be behind a permission and have the ability for users to override it. But it would be nice to have a mode where, if the type of the side panel is global, when users open/close it, it would do so globally. Kind of like the bookmarks bar always being their or not. As a user, this is the kind of behavior I’d expect rather than it being sometimes open, sometimes not or closing itself sometimes.

So to be clear, I don’t necessarily want the ability as a developer to programmatically open/close, but I want the user to have the option to keep it open when they want.

@lucasjohnston *sigh*. You have discovered one of my daily struggles 🫢… picking the right term to best describe functionality!

I truly appreciate your feedback. It helps us write our docs in a way that makes more sense for developers 😃

It’d be great if Chrome could offer this functionality

Do you mean programmatically open the side panel? Because 116 launched this feature. But it does require a use gesture 😃

Thank you @AmySteam

I reviewed the process again and unfortunately it’s not quite as intuitive.

What happens when you navigate away is that the side panel closes. When they come back, they would have to open it again, via the click action or selecting it from the side panel dropdown.

Attached video for clarity https://github.com/GoogleChrome/chrome-extensions-samples/assets/7541831/49555049-9a1a-4f0e-a247-6b2990092bcd

When I see step 2 as “pinning the extension”, I already sense it is counter-intuitive. I’d consider that as “training instructions” that should be unnecessary in an intuitive user experience.

My ideal intuitive user experience would be:

  1. Install the extension, consenting to the extension behavior.
  2. Visit a relevant website, and have the extension content presented automatically.
  3. Manual activation beyond that is not needed.

I imagine there may be some conflict over other extensions doing the same on a page, since we need to share the side panel, and, not to get too offtrack here, but I would eventually want the ability to easily have a controllable, dedicated, docked panel, much like the developer tools window. Other extensions could do the same, displaying multiple panels on a page if the user desires, all configurable to be docked on a part of the screen. Honestly that would be amazing, and this isn’t unheard of, for example, in a developer IDE where the visible text editor space is only 20% of the screen, surrounded by panels! I think it would be a great feature for many use cases.

In general, I think we need more presentation options. Outside of these new features, there is no way to safely adjust the viewport of a page, and we are left with ugly CSS hacks that do not work universally – I believe the corresponding blog post about side panels touches on the difficulties we face. Difficulties aside, intuitiveness is an important part of a software’s success, and for now, I’m stuck with dangerous CSS hacks since it does get closer to providing the behavior that I need.

The “dangerous” part is a real concern to me because I predict many support tickets complaining about the 10% of sites that will not present properly, where my extension covers text, breaks the layout, etc. Not good! Hence I was very excited to see the new sidepanel API, but it doesn’t fit my requirements currently.

@zakariaelh Good question! I’m curious, have you declared a global side panel in the manifest? Like in the example below? This will set a global side panel in all tabs. If so, can you remove this code and try again?

{
  "name": "My side panel extension",
  ...
  "side_panel": {
    "default_path": "sidepanel.html"
  }
  ...
}

Let me know if this works for you 😄

Hey Amy - whilst I understand the idea, it feels misleading that “Enable a side panel on a specific site” doesn’t actually enable the side panel, it persists it. It’d be great if Chrome could offer this functionality and/or change the wording 😃

With content scripts, we can add UI to the host page without any user interaction. This seems a common use case for content scripts. One of the benefits of the side panel is you can also add UI to enhance the browsing experience, but without detracting from the main page at all.

This is at least how I am using content scripts and side panels. There are no limitations on content scripts in terms adding UI, basically I can add any UI onto screen when the page loads. I’m unable to do so with the side panel, however.

It works, thank you so much!

Thanks Amy. Looking forward to the fun features ahead.