Skip to content

Fire Mode: Toggle switch#8606

Open
0nko wants to merge 8 commits into
feature/ondrej/fire-mode-fire-tabsfrom
feature/ondrej/fire-mode-toggle-switch
Open

Fire Mode: Toggle switch#8606
0nko wants to merge 8 commits into
feature/ondrej/fire-mode-fire-tabsfrom
feature/ondrej/fire-mode-toggle-switch

Conversation

@0nko
Copy link
Copy Markdown
Member

@0nko 0nko commented May 18, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/1207418217763355/task/1214876625000225?focus=true

Description

Adds the Fire/Regular toggle to the tab switcher toolbar. The pill replaces the title, holds the regular tab count (∞ at 100+), slides on tap or drag, and switches BrowserModeStateHolder on release. BrowserActivity reacts by recreating itself.

Steps to test this PR

Toggling between modes

  • Enable the fireTabs FF in internal dev settings
  • Open the tab switcher
  • Verify the toggle replaces the title and the right segment shows the regular tab count
  • Tap the fire segment
  • Verify the pill slides left, tab list switches to fire-mode tabs (single empty tab)
  • Drag the pill slowly past the midpoint
  • Verify it follows the finger and snaps to fire on release
  • Drag the pill less than halfway
  • Verify it snaps back to the starting side, no mode change

Browser vs tab switcher consistency

  • Open the tab switcher
  • Tap a fire mode tab item
  • Load a few websites
  • Switch to the regular mode and open a few different URLs
  • Swipe between tabs and verify the same tabs are visible in the browser and in the tab switcher
  • Switch to fire mode and repeat, making sure only the fire tabs are visible in the browser and the tab switcher

Selection

  • Open the tab switcher
  • Note the current active tab
  • Switch modes
  • Switch modes back
  • Verify the current tab selection is preserved
  • Repeat for the other mode

Scrolling

  • If you don't have enough, add more tabs so that they fill the screen (se the internal dev-settings "Add fire tabs" generator to create 100+ regular tabs, if needed)
  • Select a tab that's off-screen, in either mode
  • Open the tab switcher and verify the active tab is scrolled-to and is visible
  • Switch to the other mode and back again
  • Verify that the active tab is still visible
  • Open the tab switcher while the active tab is below the fold. It scrolls to the active tab (also after flipping modes)

Tab count

  • Use the internal dev-settings "Add fire tabs" generator to create 100+ regular tabs
  • Open the tab switcher
  • Verify the toggle shows ∞ instead of a number

Fallback

  • Disable fireTabs in internal settings and relaunch
  • Verify the toggle gone, original title back
  • Smoke test that no behavioural change vs. production

Note

Medium Risk
Changes browser-mode switching and state restoration behavior by clearing/restoring fragment/ViewModel state on mode changes, which could impact tab/webview restoration and navigation edge cases.

Overview
Adds a new Fire/Regular segmented toggle to the tab switcher toolbar (tap or drag), including showing the regular tab count with an ∞ overflow display.

Tab switching no longer relies on a passed selectedTabId; the tab switcher now auto-scrolls to the active tab on first load and after mode changes, and TabSwitcherViewModel can switch BrowserModeStateHolder when the user toggles.

Hardens BrowserActivity recreation on browser-mode changes by persisting the last saved mode, stripping restored tab pager state when the mode differs, and synchronously removing stale BrowserTabFragments after restore to prevent wrong-mode webviews from being shown.

Reviewed by Cursor Bugbot for commit 851fb5d. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Member Author

0nko commented May 18, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@0nko 0nko requested a review from CDRussell May 18, 2026 22:01
@0nko 0nko force-pushed the feature/ondrej/fire-mode-fire-tabs branch from 27e1503 to a162357 Compare May 18, 2026 22:07
@0nko 0nko force-pushed the feature/ondrej/fire-mode-toggle-switch branch from d3785f2 to 851fb5d Compare May 18, 2026 22:07
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 851fb5d. Configure here.

firstTimeLoadingTabsList = false
scrollToActiveTab()
scrollToActiveTabOnNextUpdate = false
scrollToActiveTab(it.tabSwitcherItems)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race between mode and viewState collectors may skip scroll

Low Severity

The shouldScroll boolean is captured eagerly, but scrollToActiveTabOnNextUpdate is set in a separate coroutine (the browserMode collector). If viewState emits via collectLatest before the browserMode collector processes the same upstream mode change, shouldScroll captures false and the callback resets nothing. However, the opposite timing is also possible: the browserMode collector fires first, sets the flag to true, and then a stale viewState emission (from combine reacting to the tabSwitcherData input changing before tabSwitcherItemsFlow debounce completes) consumes the flag and scrolls using the old mode's item list — then the actual new-mode emission arrives with scrollToActiveTabOnNextUpdate already reset to false, missing the intended scroll.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 851fb5d. Configure here.

@CDRussell
Copy link
Copy Markdown
Member

Bug:

  • if you rotate the tab switcher in fire mode, Tabs title appears erroneously
Screen Recording 2026-05-19 at 17 21 21

@CDRussell
Copy link
Copy Markdown
Member

Bug (might not be caused by this branch):

  • loaded a site (cnn.com) which resulted in permissions prompt
  • but had switched to a different tab before the prompt showed up, resulting in it showing over the wrong site
Screenshot_20260519_172431

@CDRussell
Copy link
Copy Markdown
Member

Shared details offline, but here too for tracking work to do. noticed a WebView crash when testing cookie setting. it's happened a few times when using http://setcookie.net/ and trying to set a cookie on fire mode and making sure it doesn't appear on regular (and vice versa)

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x18 in tid 32760 (e.android.debug), pid 32760 (e.android.debug)

Copy link
Copy Markdown
Member

@CDRussell CDRussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagged a few things, approving on the assumption they are all addressed (and because it's still behind FF)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants