Closed Bug 1852230 Opened 2 years ago Closed 10 months ago

The "Translate this page?" pop-up appears in front of the "default browser" pop-up, but the focus goes to the "default browser" pop-up

Categories

(Firefox :: Translations, defect, P3)

Desktop
Windows
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox118 --- affected
firefox119 --- affected

People

(Reporter: danibodea, Unassigned, Mentored)

Details

Attachments

(1 file)

Note

  • When the user launches the browser and both the default browser and Translate this page modals get displayed, the default browser modal has the focus even if the other one is in front of it.

Found in

  • Beta v118.0b6

Affected versions

  • Beta v118.0b6

Tested platforms

  • Affected platforms: Windows 10
  • Unaffected platforms: ?

Steps to reproduce

  1. Open a new profile
  2. Load a page that has another default language than the browser
    (This would cause the "Translate this page?" modal to be displayed)
  3. Close the browser and reopen the same user profile.
  4. When the browser reopens, it will display both the "Translate this page" modal and the "default browser" modal.

Expected result

  • The pop-up that is displayed in front should have the focus to interact with it.

Actual result

  • The "Translate this page?" pop-up appears in front of the "default browser" pop-up, but the focus goes to the "default browser" pop-up.

Regression range

  • appears to be an issue since the implementation of the "Translate this page?" modal.

Additional notes

  • additional_note1

:danibodea, if you think that's a regression, could you try to find a regression range using for example mozregression?

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

For more information, please visit BugBot documentation.

Flags: needinfo?(gtatum)

I started looking at this, but haven't had time to get a proper fix going, someone could take it over. It will probably need a test.

diff --git a/browser/components/translations/content/translationsPanel.js b/browser/components/translations/content/translationsPanel.js
index 2e81bdc7df50e..4c32094379453 100644
--- a/browser/components/translations/content/translationsPanel.js
+++ b/browser/components/translations/content/translationsPanel.js
@@ -1449,7 +1449,12 @@ var TranslationsPanel = new (class {
   handleEvent = async event => {
     switch (event.type) {
       case "TranslationsParent:OfferTranslation": {
-        if (Services.wm.getMostRecentBrowserWindow()?.gBrowser === gBrowser) {
+        if (
+          Services.wm.getMostRecentBrowserWindow()?.gBrowser === gBrowser &&
+          !(await TranslationsPanel.isBrowserShowingNotification(
+            gBrowser.selectedBrowser.browsingContext.currentWindowGlobal
+          ))
+        ) {
           this.open(event, /* reportAsAutoShow */ true);
         }
         break;
@@ -1605,3 +1610,8 @@ XPCOMUtils.defineLazyPreferenceGetter(
   "browser.translations.panelShown",
   false
 );
+
+ChromeUtils.defineESModuleGetters(TranslationsPanel, {
+  isBrowserShowingNotification:
+    "resource:///modules/UrlbarProviderSearchTips.sys.mjs",
+});
diff --git a/browser/components/urlbar/UrlbarProviderSearchTips.sys.mjs b/browser/components/urlbar/UrlbarProviderSearchTips.sys.mjs
index adba886f2c69c..30095572a243a 100644
--- a/browser/components/urlbar/UrlbarProviderSearchTips.sys.mjs
+++ b/browser/components/urlbar/UrlbarProviderSearchTips.sys.mjs
@@ -491,7 +491,7 @@ class ProviderSearchTips extends UrlbarProvider {
   }
 }
 
-async function isBrowserShowingNotification(window) {
+export async function isBrowserShowingNotification(window) {
   // urlbar view and notification box (info bar)
   if (
     window.gURLBar.view.isOpen ||
Mentor: gtatum
Severity: -- → S3
Flags: needinfo?(gtatum)
Priority: -- → P3

i would like to work on this please

Hi can I be assigned this task?

Hi, I would like to work on this.

We have lots of outreachy applicants right now, so we are assigning bugs once viable patches are attached.

Hi I am having an issue replicating this bug on Nightly sadly it doesn't show the default browser pop-up.

First i opened a browser tab to a page that is in Spanish (my default browser language is English) it does show the Translate Page pop-up then i close Nightly and re-open by running mach run it only shows the Translate Page pop-up nothing else. Or is there anything i am missing ?

Flags: needinfo?(gtatum)
Flags: needinfo?(dbodea)

I am sorry, I missed a step in the original description. To answer your question, the Default Browser should be displayed the second time you open a NEWLY created profile. Here are the whole steps:

Steps to reproduce

  1. Open the browser using a newly created profile info
  2. Load a page that has another default language than the browser (link for a page in German)
    (This would cause the "Translate this page?" modal to be displayed)
  3. Check the "Open previous windows and tabs" in about:preferences and close this page.
  4. Make sure the page in step 2 is in focus, then close the browser and reopen the same user profile.
  5. When the browser reopens, it will display both the "Translate this page" modal and the "default browser" modal.

Expected result
The pop-up that is displayed in front should have the focus to interact with it.

Actual result
The "Translate this page?" pop-up appears in front of the "default browser" pop-up, but the focus goes to the "default browser" pop-up.

Flags: needinfo?(gtatum)
Flags: needinfo?(dbodea)

Hello everyone, I tried to reproduce this bug on macOS (darwin 24.3.0) but found different behavior than reported:

Steps taken to reproduce:

  1. Created a new profile and launched Firefox
  2. Loaded www.mozilla.org/de/ (German page)
  3. Got both popups to appear:
    • Translation popup in front
    • Default browser notification behind

Observed behavior:

  1. Translation popup appears visually in front (correct)
  2. Keyboard focus stays within the translation popup:
    • Tab key navigation shows blue highlights around buttons
    • Focus moves between "Cancel" and "Translate" buttons
    • Focus does not move to the default browser popup behind
  3. Default browser notification stays behind and doesn't receive focus

This seems to be working as intended, with proper focus management. Could this bug have been fixed in a recent update? Or are there specific steps I'm missing to reproduce the focus issue?

Environment:

  • OS: macOS (darwin 24.3.0)
  • Firefox: Nightly build
Flags: needinfo?(gtatum)

It very much could have, it's probably worth getting one other confirmation that it's fixed. I don't have the time at the moment. The reporter was on Windows, so that may be good to verify before closing. I guess I was able to reproduce awhile back.

Flags: needinfo?(gtatum)

Hello, I just tested this on Windows 10 using Firefox 139.0a1 and 138.0b3. I did not reproduce the bug.

Steps followed:

  1. Created a new profile and launched it in a new browser
  2. Loaded www.mozilla.org/de/
  3. Enabled "Open previous windows and tabs"
  4. Closed the window and re-launched the profile

Behavior observed:

  • Both the translation and default browser popups appeared, with the translation popup on top as in the previously attached video
  • The tab key cycles through translation popup buttons and fields in top-to-bottom, left-to-right order, looping back to the settings button when tabbing from "Cancel"
  • Clicking around in the translation popup had not effect on the default browser popup

This all seems to be desired behavior, except that it may be more sensible for the default browser popup to appear over the translation popup, since the former prevents interaction with the rest of the window.

Flags: needinfo?(gtatum)

I have also tried reproducing the issue but am unable to reproduce it. I think it may have been fixed

Resolving as fixed, we can re-open if needed.

Status: NEW → RESOLVED
Closed: 10 months ago
Flags: needinfo?(gtatum)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: