Closed Bug 2075241 Opened 2 months ago Closed 1 month ago

[HNT] Tapping 'x' on Homepage tab shows 'Tab closed' toast without closing it

Categories

(Firefox for Android :: Homepage, defect)

All
Android
defect

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox158 --- disabled
firefox159 --- disabled
firefox160 --- fixed
firefox161 --- verified

People

(Reporter: apetridean, Assigned: npoon)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid] [group5])

Attachments

(4 files, 1 external file)

Steps to reproduce

  1. Launch Fenix with Tab Strip on.
  2. Ensure one tab is open in the Tab Strip.
  3. Tap the "x" button directly on the tab in the Tab Strip to close it.
  4. Observe that the "Tab closed - Undo" toast appears, but the tab remains visible in the Tab Strip.
  5. Tap "Undo" on the snackbar notification.

Expected behavior

Tapping 'x' on a Homepage tab should not trigger a false "Tab closed" notification if the tab cannot/should not be closed.

The Tab Strip state and the snackbar notification system should remain strictly synchronized.

Actual behavior

Tapping 'x' displays the "Tab closed - Undo" toast, but the Homepage tab remains visible and active in the Tab Strip

Device information

  • Firefox version: Nightly 158.0a1 - 24.09.2026
  • Android device model: Google Pixel 3 XL (Android 9), Samsung S23 Ultra (Android 14)
Summary: [HNT] Tapping 'x' on Homepage tab shows 'Tab closed' toast without closing it, and tapping 'Undo' creates a duplicate tab → [HNT] Tapping 'x' on Homepage tab shows 'Tab closed' toast without closing it
Whiteboard: [fxdroid] [group5]

TabStrip.kt invokes onCloseTabClick unconditionally after tabsUseCases.removeTab, and on the homepage that lambda is wired straight to the undo snackbar while onLastTabClose is a no-op (HomeFragment.kt). The last tab really is removed, but HomepageTabBinding.kt then sees zero tabs and adds a fresh about:home tab, so the strip looks unchanged while the snackbar claims a tab was closed; tapping Undo restores the original tab without removing that replacement.

Fix: Have HomeFragment's tab strip close handler mirror removeTabAndShowSnackbar and onUndoTabsRemoved in TabsCleanupFeature.kt: add the replacement homepage tab explicitly, hold its id so Undo can remove it, and skip the snackbar when the removed tab was the last one and was itself about:home. Nothing currently exercises closeTab in TabStrip.kt, so add coverage next to TabStripStateTest.kt.

Suggested severity: S3. The notification is misleading rather than destructive, the tab strip stays usable, and the only lasting effect is a duplicate homepage tab if the user taps Undo.


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, ai-triage-wrong-cause, ai-triage-hallucination, ai-triage-out-of-scope, ai-triage-wrong-fix, ai-triage-shallow-fix.

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

With HNT enabled we'd always have at least one HNT tab for the application to show something - the home page.. as a new tab.
Without HNT the homepage is shown and we could have 0 other tabs opened.
So part of this bug is expected.

I think a potential fix here would be to not allow closing the only remaining HNT tab - from the tabstrip or from the tabstray, with maybe a warning snackbar informing that this is not possible/supported. Or just hide the X button and not follow through on swiping the HNT tab off of the tabstray.

Thanks for commenting Petru. I also looked at what chrome does and closing the last and only homepage tab will open the tabs tray, which we could consider but we would need product confirmation

(In reply to Nicholas Poon [:Nick] from comment #3)

Thanks for commenting Petru. I also looked at what chrome does and closing the last and only homepage tab will open the tabs tray, which we could consider but we would need product confirmation

I see Chrome rather closing the app when the last tab is closed from the tabstrip.
Which could be the better approach.

(In reply to Petru-Mugurel Lingurar [:petru] from comment #4)

Created attachment 9648050 [details]
ClosingTheLastTabInChrome.mp4

(In reply to Nicholas Poon [:Nick] from comment #3)

Thanks for commenting Petru. I also looked at what chrome does and closing the last and only homepage tab will open the tabs tray, which we could consider but we would need product confirmation

I see Chrome rather closing the app when the last tab is closed from the tabstrip.
Which could be the better approach.

Interesting, yes that would match desktop.

Attached video OpenTabsTrayChrome.webm —

Discussed with Product and UX and it was decided that we want to show the tabs tray when closing the last tab, which is a homepage. This would also keep it in line with the close all tabs behaviour from the tabs tray.

When the user presses undo on the snackbar, the user shall stay on the tabs tray

https://mozilla.slack.com/archives/C0748C4AJ48/p1790257706777039

Assignee: nobody → npoon
Status: NEW → ASSIGNED
Attachment #9663702 - Attachment description: Bug 2075241 - [HNT] Show tabs tray when closing last homepage tab → Bug 2075241 - [HNT] Show tabs tray when closing last tab on tab strip
Flags: qe-verify+
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

The patch landed in nightly and beta is affected.

:npoon, please make an uplift decision for beta:

  • For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set status-firefox159 to wontfix if the fix can wait for the next release.

See Requesting an Uplift for documentation on how to request an uplift.

For more information, please visit BugBot documentation.

Flags: needinfo?(npoon)

Verified as fixed on the latest Nightly 161.0a1 from 26.10.2026 with Pixel 7 PRO (Android 17) and Samsung S25 (Android 15).

Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: