Closed Bug 1848801 Opened 7 months ago Closed 2 months ago

Clicking Dismiss button on Windows still opens the corresponding tab

Categories

(Toolkit :: Alerts Service, defect)

Desktop
Windows
defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox121 --- wontfix
firefox122 --- verified
firefox123 --- verified

People

(Reporter: saschanaz, Assigned: saschanaz)

References

Details

Attachments

(2 files)

Dismiss button should just dismiss the notification, and should not open anything.

Depends on: 1794475

I can't reproduce this with https://googlechrome.github.io/samples/notifications/requireInteraction.html but I saw such behavior in Google Calendar. Not sure the difference, maybe only push notifications are affected? But how?

Actually it's the Chrome example that is special, because new Notification("foo", { requireInteraction: true }) is enough to reproduce the issue.

The severity field is not set for this bug.
:nalexander, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(nalexander)

This issue is also happening with me. (Clicking the dismiss button opens the notification's respective link/tab)

Firefox 117.0 (64-bit)
Windows 11 23H2 - Build 22631.2271

The Chrome-example uses a service worker as one would do for Web Push, too. As far as I know, one needs to handle the event notificationclick in the service worker to focus or open the site. Doing so leads to the problem that is described in this bug, too: A click on the dismiss-button focuses / opens the site. So, Web Push is affected, too.

I believe that the problem in case of Web Push is that the event notificationclick is fired on click on the dismiss-button without a possibility for the event-handler to detect that only the dismiss-button was clicked. I have never recognized that Chrome fires the event on click on the dismiss-button. So, sites would need different handling for different browsers, but it seems that there is not even a solution for Firefox.

I don’t know if the root-cause for Web Push and not Web Push is the same.

Duplicate of this bug: 1863182

Per the documentation the system should handle arguments=dismiss to fire dismiss event but somehow it still fires activate event. This patch thus handles it manually while still taking advantage of the Windows provided localization of the button.

Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e92a8f339bfc
Use system dismiss button for persistent notification r=nrishel,fluent-reviewers,bolsson
Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1ed25455cf4c
Use system dismiss button for persistent notification r=nrishel,fluent-reviewers,bolsson
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Flags: needinfo?(krosylight)
Flags: needinfo?(nalexander)

Comment on attachment 9372283 [details]
Bug 1848801 - Use system dismiss button for persistent notification r=nalexander,nrishel

Beta/Release Uplift Approval Request

  • User impact if declined: (Probably is too late for beta, though)

Users getting persistent notification popup will click Dismiss button which unexpectedly opens the webpage, which is the opposite of what Dismiss is. See also bug 1863182.

  1. Click Authorize
  2. Open F12 devtools console and copypaste new Notification("foo", { requireInteraction: true })
  3. See the resulting notification
  4. Do either one of below:
    a. switch to another tab
    b. switch to another window
    c. close the current page (while not closing Firefox)
    d. close Firefox
  5. Click the Dismiss button on the notification
  6. See the button do not trigger anything e.g. opening Firefox, focusing the previous window, or switching to the tab.
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This only changes some arguments we pass to the OS.
  • String changes made/needed:
  • Is Android affected?: No
Attachment #9372283 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9372283 [details]
Bug 1848801 - Use system dismiss button for persistent notification r=nalexander,nrishel

Fx122 is now in release, switching uplift request to release as a possible ride-along

Attachment #9372283 - Flags: approval-mozilla-beta? → approval-mozilla-release?

The patch landed in nightly and beta is affected.
:saschanaz, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox122 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(krosylight)
QA Whiteboard: [qa-triaged]

We have a release approval nomination instead for a good reason!

Flags: needinfo?(krosylight)

I have reproduced this issue in Beta v122.0 (RC) on Windows 10.
Steps used:

  1. Open https://www.bennish.net/web-notifications.html
  2. Click Authorize
  3. Open F12 devtools console and copypaste new Notification("foo", { requireInteraction: true })
  4. See the resulting notification
  5. Do either one of below:
    a. switch to another tab
    b. switch to another window
    c. close the current page (while not closing Firefox)
    d. close Firefox
    Click the Dismiss button on the notification
    See the button do not trigger anything e.g. opening Firefox, focusing the previous window, or switching to the tab.

It only reproduced in cases a and b. cases c and d do not reopen the closed browser or tab.

This issue no longer occurs in Nightly v123.0a1 (from 2024-01-16).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
OS: Unspecified → Windows
Hardware: Unspecified → Desktop

:saschanaz widget/windows/ToastNotificationHandler.cpp has merge conflicts with release.
If you can attach a patch rebased on release, we can include this in a dot release ride-along.

Flags: needinfo?(krosylight)

Per the documentation the system should handle arguments=dismiss to fire dismiss event but somehow it still fires activate event. This patch thus handles it manually while still taking advantage of the Windows provided localization of the button.

Attachment #9373595 - Flags: approval-mozilla-release?

Done!

Flags: needinfo?(krosylight)
Attachment #9372283 - Flags: approval-mozilla-release?

Comment on attachment 9373595 [details]
Bug 1848801 - Use system dismiss button for persistent notification r=dmeehan

Approved for 122.0.1

Attachment #9373595 - Flags: approval-mozilla-release? → approval-mozilla-release+

I confirm this fix in RC V122.0.1 in Windows 10. Clicking the Windows notification's "Dismiss" button does not refocus the tab, the window or reopen the browser.

You need to log in before you can comment on or make changes to this bug.