Closed Bug 1911609 Opened 7 months ago Closed 27 days ago

AI shortcut doesn't appear near the selected text when the page is not 50% zoomed

Categories

(Core :: Machine Learning, defect, P1)

defect
Points:
3

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox-esr115 --- disabled
firefox-esr128 --- disabled
firefox129 --- disabled
firefox130 --- wontfix
firefox136 --- fixed

People

(Reporter: cpeterson, Assigned: ngrato)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [genai])

Attachments

(5 files)

Attached image screenshot.png

Steps to reproduce

  1. Enable the AI shortcut and set page zoom to 100% (default).
  2. Load a page (such as https://example.com) and double-click to select some text on a web page.
  3. See that the AI shortcut is displayed below and to the right of the selected text.
  4. Increase page zoom to 200% (using Ctrl + +)
  5. Double-click to select some text on the page again.

Expected result

The AI shortcut should still be displayed below and to the right of the selected text.

Actual result

The AI shortcut is display far above and to the left of the selected text. The more you zoom the page, the farther above and to the left the AI shortcut is displayed. See the attached screenshot.

Blocks: 1900914

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

For more information, please visit BugBot documentation.

Flags: needinfo?(tziade)
Blocks: 1911129
No longer blocks: 1900914
Whiteboard: [genai]
Blocks: 1922413
No longer blocks: 1911129
Points: --- → 3
Severity: -- → S3
Flags: needinfo?(tziade)
See Also: → 1922623
Assignee: nobody → emilio
Status: NEW → ASSIGNED

bug 1922623 landed with some devicePixelRatio calculation, but it seems to be quite wrong now when not zoomed. it's correct when zooming out to 50% https://searchfox.org/mozilla-central/rev/548b6981501f59e3c9f2f7851c013e7d53c4e72f/browser/components/genai/GenAI.sys.mjs#629-641

Depends on: 1922623
Priority: -- → P1
Attached image 100% zoom.png
Attached image 30% zoom.png

also, the position seems to be quite wrong for external monitors that i can't even see where it's opening up

there was a recent change perhaps bug 1931692 that seemed to break the behavior that landed with bug 1922623 that was working fine a month ago (but didn't make it to m-c yet). turns out event.screenX changes between the original mouseup event and when we access it via a setTimeout debounce

https://searchfox.org/mozilla-central/rev/548b6981501f59e3c9f2f7851c013e7d53c4e72f/browser/components/genai/GenAIChild.sys.mjs#48,65,78

so we'll just grab the value before setTimeout

Assignee: emilio → ngrato
Depends on: 1931692
Summary: AI shortcut doesn't appear near the selected text when the page is zoomed → AI shortcut doesn't appear near the selected text when the page is not 50% zoomed
See Also: → 1945171

Zoom functionality was taken care of in another patch, however there was a new bug in nightly that distorted the formula to create the popup destitation. This patch fixes some scoping issues with the variables to keep the intentional values and produce an accurate placement of the popup

Pushed by ngrato@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5045cb4ff24b AI shortcut zoomed incorrect location r=Mardak,firefox-ai-ml-reviewers
Status: ASSIGNED → RESOLVED
Closed: 27 days ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
Blocks: 1937156
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: