Skip to content

Add YouTube ad-blocking omnibar badge#9155

Open
CrisBarreiro wants to merge 8 commits into
developfrom
feature/cris/ad-blocking-omnibar-animation
Open

Add YouTube ad-blocking omnibar badge#9155
CrisBarreiro wants to merge 8 commits into
developfrom
feature/cris/ad-blocking-omnibar-animation

Conversation

@CrisBarreiro

@CrisBarreiro CrisBarreiro commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1214489465023871?focus=true
Tech Design URL (if applicable):

Description

Steps to test this PR

Feature 1

  • [ ]
  • [ ]

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

Note

Medium Risk
Moderate risk from new navigation/progress race handling and omnibar animation exclusivity in core browser UI; limited to YouTube ad-blocking feedback when injection is enabled.

Overview
Adds an address-bar “YouTube Ad Block On” badge when ad blocking is active on supported YouTube video URLs (watch, shorts, live, clip), with rules so full loads/reloads always animate, SPA navigations only animate when the video id changes, and injection-disabled skips the badge.

The ad-blocking module exposes AdBlockingOmnibarAnimationProvider; the browser tab wires page/url navigation into that API, defers the badge until load progress hits 100 when needed, clears stale state on navigation, and claims exclusivity so tracker/cookie omnibar animations are suppressed unless the badge is skipped (e.g. omnibar focused).

The omnibar gains a dedicated ad-blocking animation path that cancels competing animations and reuses the existing cookie-style slide-in scene with a static icon and feature-owned copy/resources.

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

Copy link
Copy Markdown
Collaborator Author

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

Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/ad-blocking-omnibar-animation branch from f5e7e14 to d413ce9 Compare July 10, 2026 11:49
Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt Outdated
Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt Outdated
YouTube video->video navigations use history.pushState, which the WebView reports as a full page load (new back/forward entry with a new originalUrl). They therefore took the NewPage/pageChanged path, where the badge was deferred until progressChanged(100). Those navigations never re-run a 0->100 progress cycle, so the deferred badge was stranded and never shown (it appeared on the first load and then seemingly never again).

Decide defer-vs-show from the live loading state at emit time (after getAnimation resolves) instead of a flag captured when the navigation started: a pushState nav never drops progress below 100% so it reads as not-loading and shows immediately; a genuine document load is still loading and defers to 100% as before, to avoid the badge being clobbered by the omnibar settling mid-load.
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/ad-blocking-omnibar-animation branch from d413ce9 to 69843d9 Compare July 10, 2026 18:23

@cursor cursor Bot left a comment

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.

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 69843d9. Configure here.

is WebNavigationStateChange.PageCleared -> pageCleared()
is WebNavigationStateChange.UrlUpdated -> {
// Drop any prior page's deferred badge synchronously (see NewPage above).
resetAdBlockingAnimationState()

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.

UrlUpdated clears deferred YouTube badge

Medium Severity

During a full page load, UrlUpdated calls resetAdBlockingAnimationState(), which clears a deferred StartAdBlockingAnimation before progressChanged(100) can flush it. A follow-up in-load URL tweak for the same YouTube video is treated as SPA (pageChanged = false) and skipped, so the omnibar badge may never appear.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 69843d9. Configure here.

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