Closed Bug 2082978 Opened 1 month ago Closed 1 month ago

AITab [FE] - Open in new tab: Smart Page should open next to originating tab

Categories

(Core :: Machine Learning: Frontend, defect, P1)

defect

Tracking

()

VERIFIED FIXED
160 Branch
Tracking Status
firefox160 --- verified

People

(Reporter: klower, Assigned: omarg)

References

(Blocks 1 open bug)

Details

(Whiteboard: [aiaug])

Attachments

(1 external file)

After a Smart Page is generated, if the user clicks "Open in new tab" option, the Smart Page opens at the end of the tab strip. It should open next to the originating tab.

Why this: When a user right-clicks on a link and chooses Open in a New Tab, the link opens right next to the tab where they right clicked, not at the end of tab string. So, this matches behavior elsewhere.

The card's "Open in new tab" button (and the title click on a completed card) goes to #handleOpenAITab in ToolUI.sys.mjs. That function calls URILoadingHelper.openTrustedLinkIn(window, viewerURL, "tab", { userContextId, forceForeground: true }) without passing relatedToCurrent, openerBrowser or a referrer. As a result, addTab in Tabbrowser.sys.mjs ends up with no openerTab. #insertTabAtIndex then puts the tab at the end, because browser.tabs.insertRelatedAfterCurrent only takes effect when there is an opener. Nothing Smart Window specific moves tabs afterwards.

Fix: when openTarget === "new", add relatedToCurrent: true to the openTrustedLinkIn params. GenAI.sys.mjs already does this when it opens a chatbot tab. When the click happens, gBrowser.selectedTab is the originating tab: the about:aiwindow tab in full-page mode, or the content tab in sidebar mode. The page will then behave like a link opened from the context menu. It goes after the last related tab and joins the opener's tab group, and closing it returns to the opener.

Test: extend "opens the stored page in a new tab from Open in new tab" in browser_aitab_tool_ui.js. Open an extra tab after chatTab, reselect chatTab, click the button, and assert newTab._tPos == chatTab._tPos + 1.

Suggested severity: S3. Smart Pages opened in a new tab land at the end of the tab strip instead of next to the tab they came from, which is inconsistent with normal link behaviour, but nothing breaks and the user can move the tab.


If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-{wrong-file, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.

Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.

Severity: -- → S3
Priority: -- → P1
Summary: Open in new tab: Smart Page should open next to originating tab → AITab [FE] - Open in new tab: Smart Page should open next to originating tab
Assignee: nobody → ogonzalez
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
QA Whiteboard: [qa-triage-done-c161/b160][qa-ver-needed-c161/b160]
Flags: qe-verify+
QA Contact: cgeorgiu

This issue is verified as fixed on latest Beta 160.0b2 under macOS 27.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triage-done-c161/b160][qa-ver-needed-c161/b160] → [qa-triage-done-c161/b160][qa-ver-done-c161/b160]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: