Skip to content

feat: switch default search engine to Brave Search#26356

Merged
AugmentedMode merged 21 commits into
mainfrom
feat/migrate-users-to-brave
Mar 20, 2026
Merged

feat: switch default search engine to Brave Search#26356
AugmentedMode merged 21 commits into
mainfrom
feat/migrate-users-to-brave

Conversation

@AugmentedMode

@AugmentedMode AugmentedMode commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

The MetaMask mobile in-app browser currently defaults to Google search, which shows ads that can lead users to fake/scam websites. This PR switches the default search engine to Brave Search, providing a privacy-focused, ad-free search experience that better protects users.

Changes:

  • Updated DEFAULT_SEARCH_ENGINE constant from 'Google' to 'Brave'
  • Added Brave Search URL (https://search.brave.com/search?q=) and refactored the if/else chain to a module-scoped lookup map (SEARCH_ENGINE_URLS) for cleaner extensibility and to avoid re-allocation on every call
  • Added 'Brave Search' option to the search engine picker in General Settings
  • Added Redux persist migration (121) to automatically switch all existing users to Brave, following the same pattern as migration 58
  • Updated processUrlForBrowser default parameter to use AppConstants.DEFAULT_SEARCH_ENGINE instead of hardcoded 'Google'
  • Updated SitesSearchFooter to use the shared SEARCH_ENGINE_URLS map so the "Search for ... on {engine}" label and URL correctly reflect the selected engine (previously hardcoded to Google/DuckDuckGo only)
  • Fallback for unknown search engine values now uses AppConstants.DEFAULT_SEARCH_ENGINE (Brave) instead of hardcoded Google

Changelog

CHANGELOG entry: Changed the default search engine to Brave Search for a privacy-focused, ad-free browsing experience

Related issues

Fixes:

Manual testing steps

Feature: Brave Search as default search engine

  Scenario: New user searches in the in-app browser
    Given the user has freshly installed the app

    When user types a search keyword in the browser URL bar
    Then the search results are served by Brave Search (search.brave.com)

  Scenario: Existing user is migrated to Brave Search
    Given the user previously had Google or DuckDuckGo as their search engine

    When the user updates the app and launches it
    Then the search engine setting is automatically changed to Brave
    And searches in the in-app browser use Brave Search

  Scenario: Search footer label reflects selected engine
    Given the user is typing a keyword in the browser URL bar

    When the autocomplete dropdown appears
    Then the footer shows "Search for {keyword} on Brave" (not Google)
    And tapping it navigates to search.brave.com

  Scenario: User can still select other search engines
    Given the user is on Settings > General

    When user opens the Search Engine picker
    Then Google, DuckDuckGo, and Brave Search are all available options
    And the user can switch between them
    And the search footer label updates to match the selected engine

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes core browser URL processing and the default search engine, plus a state migration that mutates persisted user settings; mistakes could send users to wrong destinations or override preferences unexpectedly.

Overview
Switches the in-app browser default search engine from Google to Brave. This updates AppConstants.DEFAULT_SEARCH_ENGINE, adds Brave to the General Settings search engine picker, and centralizes engine base URLs in SEARCH_ENGINE_URLS.

Search URL generation is refactored to use the shared lookup (with fallback to the default) in both processUrlForBrowser and SitesSearchFooter, and the footer testID/text are renamed from Google-specific to a generic trending-search-footer-search-link.

Adds migration 126 to move persisted settings.searchEngine from Google to Brave for existing users, and updates unit/integration/e2e tests and selectors to match the new engine + testIDs.

Written by Cursor Bugbot for commit 471a8dd. This will update automatically on new commits. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-product-safety Push issues to Product Safety team label Feb 20, 2026
@AugmentedMode AugmentedMode marked this pull request as ready for review February 20, 2026 15:27
@AugmentedMode AugmentedMode requested review from a team as code owners February 20, 2026 15:27
@AugmentedMode AugmentedMode self-assigned this Feb 20, 2026
Comment thread app/components/UI/Sites/components/SitesSearchFooter/SitesSearchFooter.tsx Outdated
Comment thread app/store/migrations/124.test.ts
Comment thread app/components/Views/Settings/GeneralSettings/index.js Outdated
Comment thread app/util/browser/index.test.ts Outdated
Comment thread app/store/migrations/124.ts Outdated
Comment thread app/store/migrations/index.ts Outdated
Comment thread app/store/migrations/125.ts Outdated
Comment thread app/components/UI/Sites/components/SitesSearchFooter/SitesSearchFooter.tsx Outdated
Comment thread app/components/UI/Sites/components/SitesSearchFooter/SitesSearchFooter.test.tsx Outdated
Comment thread app/components/UI/UrlAutocomplete/index.test.tsx
@AugmentedMode AugmentedMode requested a review from a team as a code owner March 11, 2026 03:35
imblue-dabadee
imblue-dabadee previously approved these changes Mar 12, 2026
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 19, 2026
Comment thread app/store/migrations/126.ts Outdated
Comment thread app/util/browser/index.ts Outdated
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 19, 2026
imblue-dabadee
imblue-dabadee previously approved these changes Mar 19, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 19, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 19, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR makes the following changes:

  1. Default search engine changed from Google to Brave (AppConstants.ts): This is a user-facing behavioral change affecting all new users and existing users via migration 126.

  2. Browser utility refactored (app/util/browser/index.ts): Added SearchEngine type and SEARCH_ENGINE_URLS map supporting Google, DuckDuckGo, and Brave. The processUrlForBrowser function now uses this map instead of hardcoded Google/DuckDuckGo logic.

  3. SitesSearchFooter updated (SitesSearchFooter.tsx): Now uses SEARCH_ENGINE_URLS for URL construction and supports Brave. The testID was renamed from trending-search-footer-google-link to trending-search-footer-search-link.

  4. GeneralSettings updated (index.js): Added Brave as a selectable search engine option in Settings.

  5. Migration 126 (126.ts + index.ts): Migrates existing users with Google as their search engine to Brave.

  6. E2E test infrastructure updated (TrendingView.selectors.ts, TrendingView.ts, trending-search.spec.ts): Updated selectors and page object methods to use the new trending-search-footer-search-link testID and renamed methods (scrollToSearchEngineOption, verifySearchEngineOptionVisible).

Tag Selection Rationale:

  • SmokeWalletPlatform: The trending-search.spec.ts is tagged with SmokeWalletPlatform and directly tests the Trending search functionality that was modified. The search footer component (SitesSearchFooter) is part of the Trending view. The E2E test infrastructure (selectors, page objects) was updated to match the new testIDs, so running this tag validates the changes end-to-end.

Tags NOT selected:

  • No other tags are needed. The changes are scoped to the browser search engine feature (Trending search, browser URL processing, settings). No confirmations, accounts, network, swaps, or other flows are affected.
  • The migration is a simple field update that doesn't affect any other controller or state that would require broader testing.

Performance tests NOT selected:

  • The changes are purely functional (search engine URL construction, default value change, migration). No rendering performance, list loading, or startup paths are affected.

Performance Test Selection:
The changes are purely functional - changing the default search engine from Google to Brave, adding Brave as a search engine option, and migrating existing users. No UI rendering performance, list loading, data fetching, or app startup paths are affected. No performance tests are warranted.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@Cal-L Cal-L 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.

LGTM

@AugmentedMode AugmentedMode enabled auto-merge March 20, 2026 13:40
@AugmentedMode AugmentedMode added this pull request to the merge queue Mar 20, 2026
Merged via the queue into main with commit bf03a94 Mar 20, 2026
98 checks passed
@AugmentedMode AugmentedMode deleted the feat/migrate-users-to-brave branch March 20, 2026 14:13
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 20, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-product-safety Push issues to Product Safety team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants