Skip to content

fix(title): keep applying title rules when the page replaces <title> - #568

Merged
sebastienfontaine merged 1 commit into
masterfrom
fix/title-observer-replaced-element
Oct 14, 2026
Merged

sebastienfontaine merged 1 commit into
masterfrom
fix/title-observer-replaced-element

Conversation

@sebastienfontaine

Copy link
Copy Markdown
Contributor

Fixes #566.

Problem

On GitHub, a rule like GitHub - {title} is applied for a moment, then the title goes back to GitHub's own.

GitHub replaces the whole <title> element after load. applyTitleRule attached its MutationObserver to the <title> element found at load time. Once GitHub swapped it, the observer was watching a detached node, so the new title was never processed.

Reproduced on master with Playwright on #557: the rule never applied over 8 seconds, and 2 distinct <title> elements were seen.

Fix

Observe document.head (child list, character data, subtree) instead of the <title> element, as the favicon observer already does. The callback is unchanged: it only acts when document.title actually changed, so our own write doesn't loop. Still far fewer callbacks than observing the whole document.

Tests

  • New RuleApplicationService.test.ts (real jsdom DOM): title applied on load, reapplied when the text changes, reapplied when the <title> element is replaced (fails without the fix), and no extra pass triggered by our own write.
  • Same Playwright check after the fix: the title becomes GitHub - … within 500 ms and stays.
  • 232 tests, ESLint, Prettier and vue-tsc pass.

…566)

GitHub replaces the <title> element after load. The title observer was
attached to the original element, so once it was detached the rule was
never reapplied and the page title won. Observe <head> instead, like the
favicon observer already does.
@github-actions

Copy link
Copy Markdown

📦 Extension Build Ready!

Version: 1.1.6

📥 Download Extension (tabee.zip)

Installation

  1. Download and extract the zip file
  2. Open Chrome → chrome://extensions/
  3. Enable "Developer mode" (top right)
  4. Click "Load unpacked" → Select the extracted folder

Status

  • ✅ All tests passed
  • ✅ Build successful
  • ✅ Ready for testing

🤖 Auto-generated by GitHub Actions

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 56.58% 627 / 1108
🔵 Statements 56.94% 660 / 1159
🔵 Functions 63.31% 126 / 199
🔵 Branches 51.58% 310 / 601
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/content/RuleApplicationService.ts 47.82% 38.77% 44.44% 49.25% 27, 31, 35, 45, 49, 54, 59-61, 91-92, 98, 124-173
Generated in workflow #474 for commit faec02c by the Vitest Coverage Report Action

@sebastienfontaine
sebastienfontaine merged commit ca58227 into master Oct 14, 2026
7 checks passed
@sebastienfontaine
sebastienfontaine deleted the fix/title-observer-replaced-element branch October 14, 2026 21:58
@sebastienfontaine sebastienfontaine mentioned this pull request Oct 14, 2026
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.

Title changing doesn't work for GitHub

1 participant