Open Bug 1815708 Opened 2 years ago Updated 2 years ago

Onboarding doorhanger should persist like permissions panels

Categories

(Firefox :: Messaging System, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: jhirsch, Unassigned)

References

(Blocks 1 open bug)

Details

When the CBH onboarding doorhanger is shown, it hides if the user switches tabs. This bug is to investigate whether we can keep it open across tab switches, like the behavior of the protections panel, for the v111 release.

I think this is valid but this isn't something the platform team can implement, Re-assigning to more appropriate team

Type: defect → enhancement
Component: Privacy: Anti-Tracking → Messaging System
Product: Core → Firefox
Flags: needinfo?(shughes)
Iteration: --- → 112.1 - Feb 13 - Feb 24

This actually isn't a duplicate, and it's not fixed by persistent_doorhanger. I think this is actually a bug in PopupNotifications, because it says persistent "will always persist even across tab and app changes", yet it does not. The reason being that it calls _update on TabSelect events, and that method checks which notifications to show - based on the current browser. And since the notification is initialized for only one specific browser (the tab that was selected when the cookiebannerdetected event fired), that check will produce an empty array when the tab is changed. Which means persistent is a misnomer, it does not persist across tab changes.

Edit: Okay, I think I figured out what's going on. When it says "persistent," it doesn't mean that the panel will stay open. It means the panel will close but will reopen when the mapped browser is selected again. If you do this in the browser console, you can see what I mean:

PopupNotifications.show(
  gBrowser.selectedBrowser,
  "addon-install-confirmation",
  "firefox",
  gUnifiedExtensions.getPopupAnchorID(gBrowser.selectedBrowser, window),
  {
    label: gNavigatorBundle.getString("addonInstall.acceptButton2.label"),
    accessKey: gNavigatorBundle.getString(
      "addonInstall.acceptButton2.accesskey"
    ),
    callback: () => {},
  },
  [],
  {
    persistent: true,
    hideClose: true,
    popupOptions: {
      position: "bottomright topright",
    },
  }
)

But in this case, it's not getting reopened, because we remove the notification on location changes without checking if it's persistent.

So one issue is that we're basically making CFRs non-persistent on our own, by removing them on tab/location changes. And a simple fix for that would be to leave persistent notifications alone until they are removed by PageActions. Basically, we would not call PopupNotifications.remove, we'd let it remove notifications when they're dismissed, and remove them from the notification map when that happens.

But that doesn't really fix this issue, because comment 0 says these doorhangers should stay open across tab switches. So, we don't really want persistence as it's currently implemented in PopupNotifications. We want doorhangers that are simply never closed. But I think this is difficult to implement with the PopupNotifications system, because it stores notifications in a structure like Map<browser, notification>. I think if we want popups that aren't tied to any particular tab, it's probably better to do this with a different messaging surface.

Flags: needinfo?(shughes)

By the way, I'm not sure what you mean by "like the permissions panels" or "like the behavior of the protections panel." The protections popup has its own dedicated panel but it also closes if you switch tabs. And iirc, the permissions panels use the same PopupNotifications system, and will also hide if you switch tabs but reappear if you switch back. It's easy to test this by opening the devtools in a tab (open to a remote page like google) and entering navigator.geolocation.getCurrentPosition(()=>{}) in the console.

Anyway, if we don't want these to be hidden when switching tabs, I'm not sure we already have a messaging surface that's suitable for this purpose. It's not practical to adapt PopupNotifications for this, and FeatureCallout actually has the same kind of implementation where it's updated when the tab switches. We have other surfaces like Spotlight that open window modal dialogs, but these prevent the user from interacting with the browser until the dialog is dismissed.

I think a new surface would need to be designed that functions similarly to AppMenuNotifications. Otherwise, we could fix the persistence issue with CFRPageActions, and just accept that these CFRs are going to hide when switching tabs but reappear when reselecting the original tab.

Iteration: 112.1 - Feb 13 - Feb 24 → 112.2 - Feb 27 - Mar 10

Current CFR support persistent_doorhanger message property that prevents the doorhanger from closing when it loses focus that is prevent the doorhanger from being dismissed if user interacts with the page or switches between applications. It doesn't account for persisting across tabs.

https://searchfox.org/mozilla-central/rev/a3a9112d4d73d1323eabbc7faa9937cd9aae6465/browser/components/newtab/content-src/asrouter/templates/CFR/templates/ExtensionDoorhanger.schema.json#39

From #comment 2 above, it seems its possible to extend CFR persistent_doorhanger property (or create a new property persistent_doorhanger_tab ) to honor persistent property as it works for PopupNotifications (i.e message hides when you navigate away from the tab that the CFR was created for, but then comes back if you navigate back to that tab) @jhirsch can you please confirm if that's the intended enhancement desired as part of this bug thanks!

Flags: needinfo?(jhirsch)

Hey Punam - Yes, the original request from product was to make the doorhanger persistent in the same way as the permissions panel doorhanger, that is, it would reappear if the user switched tabs and switched back. Since we're shipping our experiment in 111, and 111 is close to the end of the beta cycle, I think this probably can't be fixed for the experiment we're working on--resetting the priority to P3 is probably a reasonable step here.

Flags: needinfo?(jhirsch)
Priority: -- → P3

Optimistically bumping to the next cookie banner handling metabug (targeting 112), but this wouldn't strictly block us from shipping in 112.

Blocks: 1801680
No longer blocks: 1800648
Iteration: 112.2 - Feb 27 - Mar 10 → ---
You need to log in before you can comment on or make changes to this bug.