Skip to content

feat(ramps): Navigate back to token list when closing token not available modal#27277

Merged
amitabh94 merged 6 commits into
MetaMask:mainfrom
imyugioh:feat/ramp-navigate-to-token-list-on-close-unavailable-modal
Mar 10, 2026
Merged

feat(ramps): Navigate back to token list when closing token not available modal#27277
amitabh94 merged 6 commits into
MetaMask:mainfrom
imyugioh:feat/ramp-navigate-to-token-list-on-close-unavailable-modal

Conversation

@imyugioh
Copy link
Copy Markdown
Contributor

@imyugioh imyugioh commented Mar 10, 2026

Description

Fixes the "Token not available with provider" modal so that pressing the close (X) button navigates the user back to the token selection screen instead of leaving them in a stuck state.

Previously, closing the modal did nothing — the bottom sheet dismissed but no navigation occurred, leaving the user on a blank/unresponsive input screen. Now the close button behaves the same as the "Change token" button, sending the user back to the token list.

Changelog

CHANGELOG entry: Fixed a bug where closing the "Token not available" modal left the user in a stuck state instead of navigating back to the token selection screen.

Related issues

Refs: TRAM-3329

Manual testing steps

Feature: Token not available modal close behavior

  Scenario: Close button navigates back to token selection
    Given the user is in the Buy flow with a region set to US (e.g. Texas)
    And a provider is selected that does not support the chosen token (e.g. Ramp Network + UNI)

    When the "Not available" modal appears
    And the user presses the close (X) button
    Then the user is navigated back to the token selection screen
    And the token list is displayed correctly

  Scenario: Change token button still works
    Given the "Not available" modal is displayed

    When the user presses the "Change token" button
    Then the user is navigated back to the token selection screen

  Scenario: Change provider button still works
    Given the "Not available" modal is displayed

    When the user presses the "Change provider" button
    Then the provider selection modal is displayed

Screenshots/Recordings

Before

Screen.Recording.2026-03-10.122119.mp4

After

Screen.Recording.2026-03-10.121602.mp4
Screen.Recording.2026-03-10.122749.mp4
Screen.Recording.2026-03-10.151712.mp4

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

Low Risk
Low risk UI/navigation change confined to ramp bottom-sheet modals, with updated tests to cover the new dismiss/close behavior.

Overview
Fixes ramp bottom-sheet dismiss behavior to avoid leaving users in a stuck state.

TokenNotAvailableModal now navigates back to Routes.RAMP.TOKEN_SELECTION when the sheet is closed/dismissed (including the header close X), while still supporting “Change provider”. ProviderSelectionModal also adds an onClose handler that routes back to token selection only when skipQuotes is true and the sheet is dismissed without a pending action.

Tests were updated to mock/capture BottomSheet’s onClose callback and assert the new navigation outcomes.

Written by Cursor Bugbot for commit 62a65e8. 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.

@imyugioh imyugioh changed the title feat: navigate back to token list when closing token not available modal feat(ramps): Navigate back to token list when closing token not available modal Mar 10, 2026
@imyugioh imyugioh marked this pull request as ready for review March 10, 2026 17:30
@imyugioh imyugioh requested a review from a team as a code owner March 10, 2026 17:30
Copy link
Copy Markdown
Contributor

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

amitabh94
amitabh94 previously approved these changes Mar 10, 2026
@amitabh94 amitabh94 enabled auto-merge March 10, 2026 20:38
@amitabh94 amitabh94 added this pull request to the merge queue Mar 10, 2026
Merged via the queue into MetaMask:main with commit ce040e3 Mar 10, 2026
7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants