Skip to content

feat: implement Url Bar Button Updates#25418

Merged
MarioAslau merged 3 commits intomainfrom
feat/update-url-bar-design
Jan 30, 2026
Merged

feat: implement Url Bar Button Updates#25418
MarioAslau merged 3 commits intomainfrom
feat/update-url-bar-design

Conversation

@MarioAslau
Copy link
Copy Markdown
Contributor

@MarioAslau MarioAslau commented Jan 29, 2026

Description

This PR updates the WebBrowser URL bar button interactions to match the new design specifications and fix the "3 X buttons" issue.

Jira Ticket: https://consensyssoftware.atlassian.net/browse/MCWP-310

Problem

Previously, the URL bar could display up to 3 "X" buttons simultaneously:

  1. Top-left back button (always an X)
  2. Clear input button (CircleX inside input)
  3. Cancel button (could be X when showCloseButton was true)

This created a confusing user experience where multiple identical-looking buttons performed different actions.

Solution

  • Back Button: Changed icon from X to < (ArrowLeft) and hidden when URL input is focused
  • Cancel Button: Now always displays "Cancel" text (never an X icon), styled to match the Explore search bar
  • Clear Button: Unchanged - CircleX inside input to clear text (already correct)
  • Removed the showCloseButton prop that was causing the Cancel button to show an X icon in certain flows

Button Behavior Summary

State Before After
Not focused X button (left) + Tabs + Account < button (left) + Tabs + Account
Focused X button (left) + Clear (X) + Cancel (X or text) Clear (X) + Cancel (text)

Changelog

CHANGELOG entry: Updated browser URL bar buttons - back button now shows chevron icon and hides when typing, cancel button always shows text instead of X icon

Related issues

Fixes:

Manual testing steps

Feature: Browser URL Bar Button Interactions

  Scenario: User sees back button when browsing
    Given the user has opened a website in the browser
    And the URL bar is not focused

    When user views the browser top bar
    Then the back button should display a "<" chevron icon on the left
    And the tabs button and account button should be visible on the right

  Scenario: User focuses on URL bar to search
    Given the user has opened a website in the browser
    And the URL bar is not focused

    When user taps on the URL bar
    Then the back button should be hidden
    And the "Cancel" text button should appear on the right
    And the clear (X) button should appear inside the input field

  Scenario: User clears search input
    Given the user has focused on the URL bar
    And has typed some text

    When user taps the clear (X) button inside the input
    Then the text should be cleared
    And the URL bar should remain focused

  Scenario: User cancels search
    Given the user has focused on the URL bar

    When user taps the "Cancel" button
    Then the URL bar should lose focus
    And the back button "<" should reappear
    And the current page URL should be restored

  Scenario: User navigates back to Explore
    Given the user has opened a website in the browser
    And the URL bar is not focused

    When user taps the back button "<"
    Then user should be navigated back to the Explore/Trending page

Screenshots/Recordings

Before

Screenshot 2026-01-29 at 16 22 49
  • Back button showed "X" icon
  • Cancel button could show "X" icon (when opened from Trending)
  • 3 X buttons could be visible simultaneously when URL bar was focused

After

  • Back button shows "<" chevron icon
  • Back button hides when URL bar is focused
  • Cancel button always shows "Cancel" text
  • Only the clear button (inside input) shows an X when focused
UrlDesignUpdate.mov

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.

Files Changed

File Change
BrowserTab.tsx Changed back button icon to ArrowLeft, hide when URL bar focused
BrowserUrlBar.tsx Removed showCloseButton prop, simplified renderRightButton
BrowserUrlBar.types.ts Removed showCloseButton prop type
BrowserUrlBar.styles.ts Updated cancelButtonText to use default text color with medium weight
BrowserUrlBar.test.tsx Updated tests for removed showCloseButton functionality
BrowserTab/index.test.tsx Added test for back button visibility
RemoteImage/index.test.tsx Fixed flaky test by properly cleaning up Dimensions mock

Note

Medium Risk
Changes browser navigation/UI behavior (back button visibility/icon and URL bar cancel behavior), which could affect in-app browser usability and edge-case flows (e.g., focus/blur and navigation). No security- or data-sensitive logic is touched.

Overview
Browser URL bar button behavior is simplified and aligned with new designs. BrowserUrlBar no longer supports showCloseButton; when focused it always shows a text Cancel button (with updated styling), and when not focused it keeps the account button.

Browser tab header navigation is updated. BrowserTab swaps the top-left close icon to ArrowLeft and hides it while the URL bar is focused to avoid multiple “X” actions.

Tests/snapshots are updated accordingly, and RemoteImage tests now properly restore the Dimensions.get spy to reduce flakiness.

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

@MarioAslau MarioAslau self-assigned this Jan 29, 2026
@MarioAslau MarioAslau added the team-mobile-platform Mobile Platform team label Jan 29, 2026
@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.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmationsRedesigned, FlaskBuildTests, SmokeNetworkAbstractions, SmokeWalletPlatform, SmokeNetworkExpansion, SmokeMultiChainAPI
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes modify the BrowserTab and BrowserUrlBar components, which are core UI components used extensively in E2E tests. Key changes include:

  1. Browser close button icon change: Changed from Close (X) to ArrowLeft (back arrow) icon
  2. Conditional visibility: The close/back button is now hidden when URL bar is focused
  3. Cancel button simplification: Removed the showCloseButton prop - now always shows "Cancel" text when focused
  4. Style changes: Cancel button text color changed from primary blue to default text color

The tapCloseBrowserButton() method in BrowserView.ts is used in many E2E tests across:

  • Confirmations tests (transactions, signatures, token approvals, contract interactions)
  • Snaps tests (snap management)
  • Network tests (network manager)
  • Trending tests (browser navigation)

While the testID (browser-tab-close-button) remains unchanged, the conditional hiding of the button when URL bar is focused could potentially affect test flows if tests interact with the URL bar before trying to close the browser.

Selected tags cover all test categories that use browser functionality:

  • SmokeConfirmationsRedesigned: dApp transaction and signature tests
  • FlaskBuildTests: Snaps tests that use browser
  • SmokeNetworkAbstractions: Network management tests
  • SmokeWalletPlatform: Trending/discovery tests with browser
  • SmokeNetworkExpansion: Multi-chain dApp connection tests
  • SmokeMultiChainAPI: Session API tests that may use browser

Performance Test Selection:
The changes are primarily UI/UX modifications to the browser URL bar and close button (icon change, conditional visibility, style changes). These are minor visual changes that don't affect rendering performance, data loading, or app initialization. No new components are added, no list rendering changes, and no state management modifications that would impact performance metrics.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@MarioAslau MarioAslau marked this pull request as ready for review January 30, 2026 00:09
@MarioAslau MarioAslau requested a review from a team as a code owner January 30, 2026 00:09
Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

);

const backButton = screen.getByTestId('browser-tab-close-button');
expect(backButton).toBeTruthy();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test uses weak matcher instead of toBeOnTheScreen()

Low Severity · Bugbot Rules

The new test asserts element presence using toBeTruthy(), which is explicitly prohibited by the unit testing guidelines. The rules state: "Do not use weak matchers like toBeDefined or toBeTruthy to assert element presence. Use toBeOnTheScreen()." The assertion expect(backButton).toBeTruthy() does not properly verify that the element is rendered on screen.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@MarioAslau MarioAslau added this pull request to the merge queue Jan 30, 2026
Merged via the queue into main with commit 6471fcd Jan 30, 2026
134 checks passed
@MarioAslau MarioAslau deleted the feat/update-url-bar-design branch January 30, 2026 01:03
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2026
@metamaskbot metamaskbot added the release-7.65.0 Issue or pull request that will be included in release 7.65.0 label Jan 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.65.0 Issue or pull request that will be included in release 7.65.0 size-M team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants