Skip to content

feat(perps): closing order type bottom sheet with a tap outside bottom sheet closes order screen #30561

Merged
abretonc7s merged 3 commits into
mainfrom
feat/tat-3113-fix-order-type-dismissal
May 25, 2026
Merged

feat(perps): closing order type bottom sheet with a tap outside bottom sheet closes order screen #30561
abretonc7s merged 3 commits into
mainfrom
feat/tat-3113-fix-order-type-dismissal

Conversation

@abretonc7s

@abretonc7s abretonc7s commented May 22, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a bug where closing the order type bottom sheet (by tapping outside, pressing the close button, or selecting an option) would also close the entire order screen.

Root cause: PerpsOrderTypeBottomSheet passed shouldNavigateBack={!externalSheetRef} to the BottomSheet component. When embedded in PerpsOrderView (no external sheet ref), this evaluated to true, causing the BottomSheet infrastructure to call navigation.goBack() on dismiss — popping the order screen from the navigation stack. The parent's onClose callback then fired redundantly.

Fix: Set shouldNavigateBack={false} unconditionally and always pass the onClose prop through to BottomSheet, so the parent controls what happens on dismiss.

Changelog

CHANGELOG entry: Fixed order type bottom sheet dismissal incorrectly closing the order screen

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-3113

Manual testing steps

Feature: Order type bottom sheet dismissal

  Scenario: User selects an order type from the bottom sheet
    Given the user is on the perps order screen with the order type bottom sheet open

    When user taps on "Market" or "Limit" order type
    Then the bottom sheet closes
    And the order screen remains visible and functional

  Scenario: User reopens the order type bottom sheet after dismissal
    Given the user just dismissed the order type bottom sheet

    When user taps the order type button in the order header
    Then the order type bottom sheet opens again
    And the user can select a different order type

Screenshots/Recordings

Before

Order type sheet dismissal (tap outside or select option) closes the entire order screen — user is navigated back to market details.

press-before-modal-order-type.mov

After

Order type sheet dismissal keeps the order screen open. User can reopen the sheet and select a different order type.

press-after-order-type.mov

Validation Recipe

recipe.json (18 steps — order type sheet open/dismiss/reopen cycle)
{
  "schema_version": 1,
  "title": "TAT-3113: Order type bottom sheet dismissal does not close order screen",
  "jira": "TAT-3113",
  "description": "Verifies that dismissing the order type bottom sheet (by selecting an option) keeps the user on the order screen instead of navigating back.",
  "acceptance_criteria": [
    "AC1: Selecting an order type from the bottom sheet closes the sheet but does NOT close the order screen",
    "AC2: After dismissal, the order form remains visible and functional (can reopen the sheet)"
  ],
  "validate": {
    "workflow": {
      "pre_conditions": ["wallet.unlocked", "perps.ready_to_trade"],
      "entry": "nav-to-details",
      "nodes": {
        "nav-to-details": {
          "action": "navigate",
          "target": "PerpsMarketDetails",
          "params": { "market": { "symbol": "BTC" } },
          "next": "wait-details-loaded"
        },
        "wait-details-loaded": {
          "action": "wait_for",
          "test_id": "perps-market-details-long-button",
          "timeout_ms": 8000,
          "next": "open-order"
        },
        "open-order": {
          "action": "press",
          "test_id": "perps-market-details-long-button",
          "next": "wait-order-form"
        },
        "wait-order-form": {
          "action": "wait_for",
          "test_id": "perps-order-header-order-type-button",
          "timeout_ms": 5000,
          "next": "open-order-type-sheet"
        },
        "open-order-type-sheet": {
          "action": "press",
          "test_id": "perps-order-header-order-type-button",
          "next": "wait-sheet"
        },
        "wait-sheet": {
          "action": "wait_for",
          "test_id": "perps-order-type-market",
          "timeout_ms": 3000,
          "next": "screenshot-sheet-open"
        },
        "screenshot-sheet-open": {
          "action": "screenshot",
          "filename": "evidence-order-type-sheet-open.png",
          "note": "Order type bottom sheet is open showing Market and Limit options",
          "next": "dismiss-select-market"
        },
        "dismiss-select-market": {
          "action": "press",
          "test_id": "perps-order-type-market",
          "next": "wait-dismiss"
        },
        "wait-dismiss": {
          "action": "wait",
          "duration_ms": 1000,
          "next": "verify-still-on-order"
        },
        "verify-still-on-order": {
          "action": "eval_sync",
          "expression": "(function(){ var r = globalThis.__AGENTIC__.getRoute(); return JSON.stringify({ route: r.name }); })()",
          "assert": { "operator": "eq", "field": "route", "value": "RedesignedConfirmations" },
          "next": "verify-order-form-visible"
        },
        "verify-order-form-visible": {
          "action": "eval_sync",
          "expression": "(function(){ var el = globalThis.__AGENTIC__.findFiberByTestId('perps-order-view-place-order-button'); return JSON.stringify({ visible: !!el }); })()",
          "assert": { "operator": "eq", "field": "visible", "value": true },
          "next": "screenshot-after-dismiss"
        },
        "screenshot-after-dismiss": {
          "action": "screenshot",
          "filename": "evidence-order-still-visible.png",
          "note": "Order form still visible after selecting order type — order screen was NOT closed",
          "next": "reopen-sheet"
        },
        "reopen-sheet": {
          "action": "press",
          "test_id": "perps-order-header-order-type-button",
          "next": "wait-reopen"
        },
        "wait-reopen": {
          "action": "wait_for",
          "test_id": "perps-order-type-limit",
          "timeout_ms": 3000,
          "next": "select-limit"
        },
        "select-limit": {
          "action": "press",
          "test_id": "perps-order-type-limit",
          "next": "wait-dismiss-2"
        },
        "wait-dismiss-2": {
          "action": "wait",
          "duration_ms": 1000,
          "next": "verify-still-on-order-2"
        },
        "verify-still-on-order-2": {
          "action": "eval_sync",
          "expression": "(function(){ var r = globalThis.__AGENTIC__.getRoute(); return JSON.stringify({ route: r.name }); })()",
          "assert": { "operator": "eq", "field": "route", "value": "RedesignedConfirmations" },
          "next": "screenshot-final"
        },
        "screenshot-final": {
          "action": "screenshot",
          "filename": "evidence-limit-selected-still-on-order.png",
          "note": "After selecting Limit order type, order form still visible with limit type active",
          "next": "done"
        },
        "done": {
          "action": "end",
          "status": "pass"
        }
      }
    }
  }
}

Validation Logs

Command:

IOS_SIMULATOR=mm-3 bash scripts/perps/agentic/validate-recipe.sh .task/feat/tat-3113-0521-165010/artifacts/ --skip-manual
Full output (18/18 passed)
Running recipe: TAT-3113: Order type bottom sheet dismissal does not close order screen
Pre-conditions: wallet.unlocked, perps.ready_to_trade
Workflow nodes: 19

Pre-conditions: PASS

[nav-to-details] navigate to PerpsMarketDetails — PASS
[wait-details-loaded] wait for perps-market-details-long-button — PASS
[open-order] press perps-market-details-long-button — PASS
[wait-order-form] wait for perps-order-header-order-type-button — PASS
[open-order-type-sheet] press perps-order-header-order-type-button — PASS
[wait-sheet] wait for perps-order-type-market — PASS
[screenshot-sheet-open] screenshot evidence-order-type-sheet-open.png — PASS
[dismiss-select-market] press perps-order-type-market — PASS
[wait-dismiss] wait 1000ms — PASS
[verify-still-on-order] eval_sync route=RedesignedConfirmations — PASS
[verify-order-form-visible] eval_sync visible=true — PASS
[screenshot-after-dismiss] screenshot evidence-order-still-visible.png — PASS
[reopen-sheet] press perps-order-header-order-type-button — PASS
[wait-reopen] wait for perps-order-type-limit — PASS
[select-limit] press perps-order-type-limit — PASS
[wait-dismiss-2] wait 1000ms — PASS
[verify-still-on-order-2] eval_sync route=RedesignedConfirmations — PASS
[screenshot-final] screenshot evidence-limit-selected-still-on-order.png — PASS

Results: 18/18 passed
Recipe: PASS

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
Single-component BottomSheet prop change for a nested sheet; no auth, payments, or shared infrastructure changes.

Overview
Fixes perps order flow navigation so dismissing the order type bottom sheet no longer pops the whole order screen.

PerpsOrderTypeBottomSheet now always passes shouldNavigateBack={false} to BottomSheet and always wires onClose, instead of enabling navigation.goBack() when no external sheetRef is provided. Dismissal (tap outside, close, or picking Market/Limit) only runs the parent onClose handler and leaves the user on the order form.

Reviewed by Cursor Bugbot for commit 77e3642. Bugbot is set up for automated code reviews on this repo. 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.

@metamaskbotv2 metamaskbotv2 Bot added the team-perps Perps team label May 22, 2026
…der screen

Set shouldNavigateBack=false on PerpsOrderTypeBottomSheet's BottomSheet
to prevent double navigation.goBack() when dismissing the sheet.

The BottomSheet infrastructure was calling goBack() on dismiss (via
shouldNavigateBack=true) in addition to the parent's onClose callback,
causing the order screen to close unexpectedly.

TAT-3113
@abretonc7s abretonc7s marked this pull request as ready for review May 22, 2026 02:13
@abretonc7s abretonc7s requested a review from a team as a code owner May 22, 2026 02:13
@abretonc7s abretonc7s changed the title feat(perps): [mobile] closing order type bottom sheet with a tap outside bottom sheet closes order screen [NOT-READY] feat(perps): [mobile] closing order type bottom sheet with a tap outside bottom sheet closes order screen May 22, 2026
@abretonc7s abretonc7s enabled auto-merge May 22, 2026 08:42
@abretonc7s abretonc7s changed the title feat(perps): [mobile] closing order type bottom sheet with a tap outside bottom sheet closes order screen feat(perps): closing order type bottom sheet with a tap outside bottom sheet closes order screen May 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The change affects a UI component inside the Perps feature: PerpsOrderTypeBottomSheet. This bottom sheet is part of the perpetuals trading flow (order type selection such as market/limit). Any regression here could break order placement flows or UI interactions within Perps.

According to tag definitions:

  • SmokePerps covers Perps trading flows (entry via TradeWalletActions, Add Funds, balance verification, multi-account scenarios).
  • When selecting SmokePerps, we must also select SmokeWalletPlatform (because Perps is embedded in the Trending section) and SmokeConfirmations (Add Funds deposits are on-chain transactions and use confirmation UI).

Although the file is a UI component and not a controller or core engine file, it directly impacts a critical trading surface. Therefore, we run Perps-related flows plus their required dependent tags to safely validate the feature end-to-end.

No other domains (Accounts, Identity, Network, Snaps, Browser, Onboarding, etc.) are impacted by this change.

Performance Test Selection:
The change is limited to a specific Perps bottom sheet UI component and does not indicate modifications to rendering of large lists, state management, controllers, navigation initialization, or app startup logic. There is no evidence of changes affecting performance-critical paths such as asset loading, account lists, onboarding, launch time, swaps, or prediction market loading. Therefore, performance tests are not required.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@abretonc7s abretonc7s added this pull request to the merge queue May 25, 2026
Merged via the queue into main with commit 59e4e97 May 25, 2026
307 of 309 checks passed
@abretonc7s abretonc7s deleted the feat/tat-3113-fix-order-type-dismissal branch May 25, 2026 14:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 25, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.80.0 Issue or pull request that will be included in release 7.80.0 label May 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

agentic release-7.80.0 Issue or pull request that will be included in release 7.80.0 size-XS team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants