Fix/edge newtab background on user navigation#27
Open
s-maheshbabu wants to merge 2 commits into
Open
Conversation
Problem: In Microsoft Edge, when a user has custom rules configured (e.g. edge://*), the extension uses a "pendingIds" mechanism to defer background-forcing for tabs created without a URL. This is needed because Edge sometimes creates a blank tab before loading the link target, unlike Chrome which sets pendingUrl on the tab immediately. The side effect: pressing CMD+T (or the new tab button) also creates a blank tab with no URL, which ends up in pendingIds. When the user then types a URL in the address bar and hits Enter, the extension treats that navigation the same as a link click and forces the tab to background — switching the user back to the previous tab against their intent. Fix: Replace the tabs.onUpdated pendingIds handler with a webNavigation.onCommitted listener. The webNavigation API exposes transitionType on every navigation: - "link" → user clicked a link (should background) - "typed" / "generated" / etc. → user typed in the address bar (skip) Edge's internal edge://newtab/ page does not fire webNavigation events, so a CMD+T tab stays in pendingIds until the user navigates to an http/https URL. At that point transitionType is "typed", not "link", so handleTabCreate is skipped and the tab correctly remains in the foreground. Adds the "webNavigation" permission to manifest.json. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
This is a fix to make this extension work in Microsoft Edge. I understand this is a ChromeExtension but Edge officially supports the ability to run Chrome extensions inside Edge. The fix has been tested on both Edge and Chrome.
In Microsoft Edge, when a user has custom rules configured (e.g. edge://*), the extension uses a "pendingIds" mechanism to defer background-forcing for tabs created without a URL.
The side effect: pressing CMD+T (or the new tab button) creates a blank tab with no URL, which ends up in pendingIds. When the user then types a URL in the address bar and hits Enter, the extension treats that navigation the same as a link click and forces the tab to background — switching the user back to the previous tab against their intent.
Fix:
Replace the tabs.onUpdated pendingIds handler with a webNavigation.onCommitted listener. The webNavigation API exposes transitionType on every navigation:
Edge's internal edge://newtab/ page does not fire webNavigation events, so a CMD+T tab stays in pendingIds until the user navigates to an http/https URL. At that point transitionType is "typed", not "link", so handleTabCreate is skipped and the tab correctly remains in the foreground.
Adds the "webNavigation" permission to manifest.json.