Closed Bug 1852191 Opened 9 months ago Closed 9 months ago

popup tooltip of html element appear even when window is out of focus

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 119
x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: fanzhuyifan+github, Assigned: fanzhuyifan+github)

References

Details

Attachments

(2 files)

Attached file test.html

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

Steps to reproduce:

Environment: firefox nightly on linux with X11, on xfce with xfwm

  1. hover the mouse on top of a html element that will show a tooltip (e.g., see attached html)
  2. before the tooltip appears, alt-tab to switch window, or use hot key to change to another workspace

Actual results:

The tooltip appears (possibly above other windows or in another workspace), even though firefox is not in focus.

Expected results:

The tooltip shouldn't have appeared, or should have stayed with the corresponding firefox window.

OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Component: Untriaged → General

This is different from 148624 in that 148624 was related to XUL components, while this is related to HTML elements on web pages displaying in firefox.

Summary: tooltip of html element appear even when window is out of focus → popup tooltip of html element appear even when window is out of focus

(In reply to fanzhuyifan+github from comment #1)

This is different from 148624 in that 148624 was related to XUL components, while this is related to HTML elements on web pages displaying in firefox.

What I previously said is incorrect. By adding print statements, I can confirm that the relevant code is also the ShowTooltip() function from layout/xul/nsXULTooltipListener.cpp. So this is related to 148624.
In addition, I confirmed on my computer that this is not a regression caused by https://phabricator.services.mozilla.com/D187418

Component: General → XUL
Product: Firefox → Core

Further debugging shows that ShowTooltip() is called and correctly exists from the fix https://phabricator.services.mozilla.com/D187418
However, for some reason the tooltip still shows up.

I added more print statements and here is the call graph I think is causing the graph:

  1. In docshell/base/nsDocShellTreeOwner.cpp, sTooltipCallback is fired
  2. This calls ShowTooltip in the same file
  3. This calls OnShowTooltip from dom/ipc/BrowserChild.cpp
  4. This calls SendShowTooltip
  5. So RecvShowTooltip from dom/ipc/BrowserParent.cpp is called
  6. This calls XULBrowserWindow.showTooltip from browser/base/content/browser.js

None of these steps checks if the relevant firefox window has lost focus. Hence, the tooltip is erroneously displayed.
To fix the issue, where do you think we should insert code to check if the current window is active?

Assignee: nobody → fanzhuyifan+github
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Component: XUL → DOM: Core & HTML
See Also: → tooltip-ghost
Attachment #9352160 - Attachment description: Bug 1852191 - Only show tooltip when document has focus. r=emilio,stransky,masayuki → Bug 1852191 - Only show popups when window has focus. r=emilio,stransky,masayuki
Attachment #9352160 - Attachment description: Bug 1852191 - Only show popups when window has focus. r=emilio,stransky,masayuki → Bug 1852191 - Only show tooltip when document has focus. r=emilio,stransky,masayuki
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/640ad6a53cf8
Only show tooltip when document has focus. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: