Closed Bug 2092299 Opened 16 days ago Closed 11 days ago

Closing TB to tray and then clicking on a system notification (Delete/Mark as read) restores the program to the foreground

Categories

(Thunderbird :: OS Integration, defect)

Thunderbird 154
Unspecified
Windows
defect

Tracking

(thunderbird_esr153 unaffected)

RESOLVED FIXED
162 Branch
Tracking Status
thunderbird_esr153 --- unaffected

People

(Reporter: helge.huettenlechner, Assigned: lachcim)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 external file)

Closing TB to tray and then clicking on a system notification (Delete/Mark as read) restores the program to the foreground.

This undesired. Just minimising doesn't restore when a notification is clicked.

This is a regression wrt. to TB 153. When minimising to the tray in 153, clicking onto a notification also didn't restore.

Flags: needinfo?(mszopinski)
Regressed by: 2044250

I can confirm that the bug does occur but it's unrelated to the change to HandleIconLeftClick (or HandleIconActivate as it's currently called). Removing the IsIconic check does not resolve the issue. As a matter of fact, HandleIconActivate is not being called here at all.

There has recently been a change to the notification system that merged around the same time as my changes did: https://phabricator.services.mozilla.com/D308321. This may or may not be relevant here. I'll try to investigate.

Flags: needinfo?(mszopinski)

I've just pasted the regression range that mozregression gave me.

You can re-run it with an interval of a week to see whether you can reproduce it. The test is very simple: Use an IMAP account. When mozregression opens a version to test, send yourself an e-mail and immediately close the main window to the tray. When the notification arrives, click "Delete". You get the outcome in one session of the version offered by mozregression.

The equivalent m-c range is this:
https://hg-edge.mozilla.org/mozilla-central/pushloghtml?fromchange=753949d46919a43c1c0105e49607eaa33c047a9e&tochange=e3ade567c5856015183569f9161a9381c43b3834
I looked for "toast" and "notif", but didn't see a related bug.

The bug you're referring to, bug 2049782, landed in July 2026, about two weeks after the regression, if the range is correct.

When Thunderbird is hidden and moved to the tray, the user may still receive notifications about incoming emails. Clicking the notification should restore Thunderbird. Clicking an action button like "Mark as read" should not.

ToastNotificationHandler.cpp in mozilla-central unconditionally calls SetForegroundWindow on the most recent browser window when a notification is clicked. Apparently, minimizing the window before hiding it prevents SetForegroundWindow from un-hiding it. This is what we used to do prior to D308142. Here, we do it inside HideWindow to make sure the behavior stays consistent.

Testing:
1. Enable "When Thunderbird is closed, move it to the tray"
2. Enable "Show an alert for new emails" and "Use the system notification"
3. (Optional) Start devtools
4. Close Thunderbird to the tray
5. Get an incoming email notification. Here's a shortcut: MailNotificationManager._showAlert({ folder: { generateMessageURI: () => "", markMessagesRead: () => {} } }, "hello", "world", 1)
6. Click the notification itself, not one of the action buttons
7. Thunderbird should reappear
8. Close Thunderbird to the tray
9. Get an incoming email notification
10. Click one of the action buttons, e.g. "Mark as Read"
11. Thunderbird should not reappear

Assignee: nobody → mszopinski
Status: NEW → ASSIGNED

My bad, it didn't occur to me that this behavior could really be affected by minimizing the window. Thanks for double checking!

Version: Thunderbird 162 → Thunderbird 154

Check-in needed. It asked for a target milestone, I hope I got that right.

Target Milestone: --- → 162 Branch

Pushed by jtracey@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/739beb08ba75
Don't restore hidden windows when a notification action is clicked. r=aleca

Status: ASSIGNED → RESOLVED
Closed: 11 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: