Closed Bug 1869796 Opened 7 months ago Closed 6 months ago

XUL notification steals focus when triggered

Categories

(Core :: Widget: Gtk, defect, P2)

Firefox 122
defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox120 --- unaffected
firefox121 --- unaffected
firefox122 --- wontfix
firefox123 --- fixed

People

(Reporter: nazar, Assigned: emilio)

References

(Regressed 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(8 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

Use anything on the web that uses notifications. Slack, Google Calendar, literally anything. It worked properly until a few weeks ago, now it is basically broken.

Actual results:

Notification does show up, but it is not rendered, instead it takes the same background as an app below it, so it is essentially invisible. I can see that after switching virtual desktops, in which case it is re-painted with previous virtual desktop's screen contents. It is also not clickable anymore

Expected results:

Should render its contents properly and be clickable.

The Bugbug bot thinks this bug should belong to the 'Toolkit::Alerts Service' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Alerts Service
Product: Firefox → Toolkit

(In reply to Nazar Mokrynskyi from comment #0)

Notification does show up, but it is not rendered, instead it takes the same background as an app below it, so it is essentially invisible.

Hi reporter, can you take a screenshot of this, assuming it's at least partly visible in certain situation? Also, does your system use libnotify? Thanks!

Flags: needinfo?(nazar)

The screen I was on had black background in notification area. Then I switched to a different virtual screen and saw this.

Notifications from Firefox look nothing like notify-send notifications, so I don't think it uses libnotify.

I'm using a custom DE with Qtile window manager and Compton compositor on X11.

Flags: needinfo?(nazar)

Hmm, sounds much like a widget/gtk thing. Hi GTK people, does anything come to your mind from comment #3?

Flags: needinfo?(stransky)
Flags: needinfo?(karlt)

(In reply to Nazar Mokrynskyi from comment #3)

Notifications from Firefox look nothing like notify-send notifications, so I don't think it uses libnotify.

How did it look when it worked? Can you try the stable channel?

Flags: needinfo?(nazar)

When it worked it looked like a gray rectangle (I use dark theme) with icon, text and close button in top right corner. Somewhat similar to notifications Thunderbird is still showing to me (except in Thunderbird is always Thunderbird's icon and it shows up in bottom right rather than top right corner).

Flags: needinfo?(nazar)

It's hard to see from the text descriptions that it's XUL based or libnotify. 🥲

When you try with the stable channel, does it have the same issue? (In other words, is there a chance that this is not a Firefox side regression?)

Flags: needinfo?(nazar)

Firefox 120.0.1 stable works fine, notification looks like on attached image. Must be nightly regression.

Flags: needinfo?(nazar)

Okay, that's definitely XUL, thanks! Can you try pip install mozregression && mozregression --good 2022-12-13 --bad 2023-12-13 to bisect the culprit?

Flags: needinfo?(nazar)

mozregression is a pretty cool bisection tool!

4:17.75 INFO: Last good revision: 5f6fad561a65b0f9103350cccffd4fec374b214c
4:17.75 INFO: First bad revision: 2c0e51ad033428fa026ec754cccd91c9ae4f2a26
4:17.75 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=5f6fad561a65b0f9103350cccffd4fec374b214c&tochange=2c0e51ad033428fa026ec754cccd91c9ae4f2a26

Flags: needinfo?(nazar)

Okay, that says this is a regression from bug 1864382. Thank you very much to provide all the details!

Component: Alerts Service → Widget: Gtk
Keywords: regression
Product: Toolkit → Core
Regressed by: 1864382
Status: UNCONFIRMED → NEW
Ever confirmed: true

Thanks, will look at it. Looks like a child window misconfiguration related to mContainer.

Flags: needinfo?(karlt)

Set release status flags based on info from the regressing bug 1864382

(In reply to Martin Stránský [:stransky] (ni? me) from comment #12)

Thanks, will look at it. Looks like a child window misconfiguration related to mContainer.

:stransky any updates on this? We are in beta for Fx122 but can take an uplift.
Could you add a severity when you have a moment?

Will looking at it. We use this notification as a fallback is libnotify is missing (which is not expected - I have no idea why someone removes it?).
As a workaround you can install libnotify package which is available for all distros and should be there by default.

Severity: -- → S3
Priority: -- → P2
Flags: needinfo?(stransky)
Summary: Notifications are not working properly in Nightly → Build-in notifications are not working properly in Nightly if libnotify is missing
Assignee: nobody → stransky

Nazar, just out of curiosity, which distro/system do you use? Did you removed libnotify intentionally?

Flags: needinfo?(nazar)
Flags: needinfo?(stransky)

I am on Ubuntu 22.04 right now and I have both libnotify-bin and libnotify4 installed and always had them.
No idea why Firefox and Thunderbird do not use them, but it was like this at least for a few years as I'm using Firefox Nightly and Thunderbird Beta versions that are direct from Mozilla (not packaged in deb).

Flags: needinfo?(nazar)

Notification started to work properly again in latest Nightly build I just installed

Okay, there is one big regression comparing to before.
Notifications now capture focus. So if I'm typing something and notification happens, focus is taken away and I need to click on the text field to continue typing.
This is a massive usability issue, extremely counter-productive.

And looks like Thunderbird updated to newer base and 122.0b1 is having the same notification issue there now.

Notification started to work properly again in latest Nightly build I just installed

👀 Can you use mozregression to see which build caused the (good) change?

Flags: needinfo?(nazar)

This one: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=d75adfaf9dd069655754ef9e0d6510bf16f506a0&tochange=7f3e10bdd2af504b2affd3847c27a4ec3b8ca8a2

But I think window doesn't have proper classes on it, which makes it capture focus and only show on one virtual desktop instead of all as normal notifications do.

So it is a step into the right direction, but not a proper fix.

Flags: needinfo?(nazar)

Thanks! Emilio, care to take a look per comment #22?

We still need to know why Firefox is failing to detect libnotify and use XUL at all, though.

Flags: needinfo?(emilio)
See Also: → 1870512

Nazar, can you check the value of alerts.useSystemBackend in about:config? If this is false then it always uses XUL.

Flags: needinfo?(nazar)

alerts.useSystemBackend is true and always was that way, I already checked it during initial debugging

Flags: needinfo?(nazar)

First of all, is there something in dmesg or the journal the first time a notification is received? It should probably highlight what's going on with libnotify. Alternatively if you have a build, looking at here should help figure out what's up.

I guess the focus stuff could be explained for this. It's unclear to me that was ever meant to apply to top-level windows, but it probably did.

We'd need to plumb stuff through a little differently to support that.

First of all, is there something in dmesg or the journal the first time a notification is received?

Nothing in kernel logs, nothing in logs firefox prints in terminal either.

Assignee: stransky → emilio
Flags: needinfo?(stransky)
Flags: needinfo?(emilio)

nsBaseWidget already stores these / exposes IsPIPWindow().

This makes clearer which bits are free and so on.

Depends on D197866

And rename CHROME_WINDOW_MIN to CHROME_WINDOW_MINIMIZE, for parallel
with the resize flag.

Depends on D197868

CHROME_MODAL implies CHROME_DEPENDENT.

Depends on D197869

The only caller already is calculating a lot of other flags.

Depends on D197870

Before bug 1869796 they had an utility type hint, now they have a
toplevel type hint, after the patch they have a notification type hint,
which seems more appropriate.

Depends on D197871

Are the patches for comment #19? Should the bug title change?

Flags: needinfo?(emilio)

Yes, and maybe? The title is rather general but comment 19 is still "not working properly" :)

Flags: needinfo?(emilio)
Summary: Build-in notifications are not working properly in Nightly if libnotify is missing → XUL notification steals focus when triggered
Keywords: leave-open
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d209e8f5b754
Minor nsWindow clean-ups. r=stransky
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9fe33a9242c6
Use shifts to define chrome flags. r=smaug
https://hg.mozilla.org/integration/autoland/rev/3af518535720
Fix some clang-tidy warnings in nsAppShellService. r=stransky
https://hg.mozilla.org/integration/autoland/rev/8fe5f47abacb
Remove some unused chrome flags. r=smaug,sessionstore-reviewers,dao
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9201220ea63a
Inline CalculateChromeFlagsHelper. r=smaug
Attachment #9371463 - Attachment is obsolete: true
Keywords: leave-open
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6a4793cef01a
Make xul alert windows have the appropriate type hint. r=stransky

:emilio this hasn't landed in central yet, but we are in the final week of beta for Fx122 so reaching out about uplifts.
Any concerns with fixing this in Fx122? Will it be safe to uplift for beta?

Flags: needinfo?(emilio)

So the real fix for rendering of the notification is in bug 1870512. This only fixes the focus issue afterwards.

Given that, I think we'd have to uplift bug 1870512. The focus issue seems probably bearable for the rare-ish case non-native notifications are used.

Flags: needinfo?(emilio)

The patch landed in nightly and beta is affected.
:emilio, 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?(emilio)
Flags: needinfo?(emilio)

I'm using the latest Nightly as of right now (123.0a1 (2024-01-11)) and the window still steals focus just like before, did the fix actually land or did anyone test that it works as expected?

Any updates? 123 was still broken despite tagged as fixed, 124 arrived yesterday, still broken the same way.

Do you want to double check?

Flags: needinfo?(emilio)

(In reply to Nazar Mokrynskyi from comment #48)

Any updates? 123 was still broken despite tagged as fixed, 124 arrived yesterday, still broken the same way.

Your WM is probably giving focus to the window even though it has a notification role (since the role changed from "utility" to notification).

Flags: needinfo?(emilio)

Let's file a separate bug to track that, but the real thing to fix here is bug 1873384, IMO.

I'm using the latest Nightly as of right now (123.0a1 (2024-01-11)) and the window still steals focus just like before, did the fix actually land or did anyone test that it works as expected?

I can confirm similar behavior (if not same) on Windows and filed bug 1878037.

See Also: → 1878037

So the issue is definitely not fixed and should be reopened. The already landed fix is almost complete though, according to discussion at https://github.com/qtile/qtile/issues/4662 "override-redirect" attribute is missing that will fix the issue fully.

Flags: needinfo?(emilio)
Blocks: 1882033

Let's track that in bug 1882033

Flags: needinfo?(emilio)
Regressions: 1881434
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: