Skip to content

Tab grouping support#146

Open
RobAntcliff wants to merge 4 commits intojamesr981:masterfrom
RobAntcliff:tab-grouping-support
Open

Tab grouping support#146
RobAntcliff wants to merge 4 commits intojamesr981:masterfrom
RobAntcliff:tab-grouping-support

Conversation

@RobAntcliff
Copy link

@RobAntcliff RobAntcliff commented Oct 12, 2025

Overview

This PR enhances the extension's tab management by preserving tab group context when opening new tabs. When a user opens a new tab from within a Chrome tab group, the new tab will automatically be placed in the same group, maintaining organizational context.

Problem

Previously, when opening new tabs from the extension, they would be created without any group association, even if the source tab was part of a tab group. This broke the user's organizational structure and required manual re-grouping of tabs.

Solution

Implemented a flexible tab grouping system that:

  • Preserves tab group context when opening new tabs in Chrome
  • Gracefully falls back in Firefox (where tab groups aren't supported)
  • Maintains Firefox container context

Implementation Details

1. Browser Abstraction Layer (webext.ts)

  • Created a unified API for browser operations that handles Chrome/Firefox differences
  • Added type-safe tab group operations for Chrome
  • Implemented promisified versions of Chrome APIs for consistent async handling

2. Tab Group Strategy (gopath.ts)

Added two grouping strategies:

type GroupStrategy =
  | { kind: "same-group" }                 // join source tab's group
  | { kind: "named-group"; title: string } // find/create group by title

3. Tab Creation Logic

  • New tabs are created adjacent to the source tab
  • Group context is preserved in Chrome
  • Container context is preserved in Firefox
  • Implemented through message passing to background script for proper extension architecture

Cross-browser Compatibility

  • Chrome: Full support for tab group preservation
  • Firefox: Graceful fallback (ignores group operations while preserving container context)

Testing

To test this change:

  1. Open a tab within a tab group in Chrome
  2. Use the extension to navigate to a different path
  3. Verify the new tab appears in the same group
  4. Repeat in Firefox to verify normal operation without groups

Sorry about them being gifs and low res. Github has a 10Mb limit on file uploads

Firefox Test:

Firefox HappierPath Tab Testing

Chrome Test:

Screen Recording 2025-10-12 at 18 11 45

@RobAntcliff RobAntcliff marked this pull request as ready for review October 12, 2025 17:34
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.

1 participant