Commit a86c788
chore(runway): cherry-pick feat: implement Url Bar Button Updates (#25459)
- feat: implement Url Bar Button Updates (#25418)
## **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: <!-- Add issue number if applicable -->
## **Manual testing steps**
```gherkin
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**
<img width="450" height="316" alt="Screenshot 2026-01-29 at 16 22 49"
src="https://github.com/user-attachments/assets/3dba6e1b-9f3f-4dae-8f9c-17512524bf87"
/>
- 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
https://github.com/user-attachments/assets/68be1901-f419-4d1e-891f-6d976709a610
<!-- Add actual screenshots/recordings here -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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 |
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk UI behavior/styling changes in the in-app browser header plus
test updates; main risk is minor UX regressions around focus state and
navigation affordances.
>
> **Overview**
> **Browser URL bar button behavior is simplified to match new
designs.** `BrowserUrlBar` no longer supports `showCloseButton`; when
focused it always shows a text **Cancel** button (with updated styling)
instead of sometimes rendering a close icon.
>
> **Browser header navigation icon is updated.** `BrowserTab` replaces
the left-side close icon with an `ArrowLeft` button and hides it while
the URL bar is focused.
>
> Tests and snapshots are updated accordingly, and `RemoteImage` tests
now properly restore the `Dimensions.get` spy to reduce test flakiness.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
be165e0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[6471fcd](6471fcd)
Co-authored-by: Aslau Mario-Daniel <marioaslau@gmail.com>1 parent 1b55cbd commit a86c788
9 files changed
Lines changed: 45 additions & 103 deletions
File tree
- app/components
- Base/RemoteImage
- UI/BrowserUrlBar
- __snapshots__
- Views/BrowserTab
- __snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
339 | 341 | | |
340 | | - | |
| 342 | + | |
341 | 343 | | |
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
| 65 | + | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | 557 | | |
612 | | - | |
| 558 | + | |
613 | 559 | | |
614 | | - | |
| 560 | + | |
615 | 561 | | |
616 | 562 | | |
617 | 563 | | |
| |||
620 | 566 | | |
621 | 567 | | |
622 | 568 | | |
623 | | - | |
624 | | - | |
625 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
626 | 572 | | |
627 | 573 | | |
628 | 574 | | |
629 | 575 | | |
630 | 576 | | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | 577 | | |
637 | 578 | | |
638 | 579 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| |||
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 145 | + | |
159 | 146 | | |
160 | 147 | | |
161 | 148 | | |
| |||
170 | 157 | | |
171 | 158 | | |
172 | 159 | | |
173 | | - | |
174 | 160 | | |
175 | 161 | | |
176 | 162 | | |
177 | | - | |
178 | | - | |
179 | 163 | | |
180 | 164 | | |
181 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
175 | | - | |
| 174 | + | |
| 175 | + | |
176 | 176 | | |
| 177 | + | |
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1395 | 1395 | | |
1396 | 1396 | | |
1397 | 1397 | | |
1398 | | - | |
1399 | | - | |
1400 | | - | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1404 | 1406 | | |
1405 | 1407 | | |
1406 | 1408 | | |
| |||
1414 | 1416 | | |
1415 | 1417 | | |
1416 | 1418 | | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
1420 | 1419 | | |
1421 | 1420 | | |
1422 | 1421 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
106 | 121 | | |
107 | 122 | | |
108 | 123 | | |
| |||
0 commit comments