feat(perps): closing order type bottom sheet with a tap outside bottom sheet closes order screen #30561
Conversation
…ide bottom sheet closes order screen
|
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. |
…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
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: According to tag definitions:
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: |
|



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:
PerpsOrderTypeBottomSheetpassedshouldNavigateBack={!externalSheetRef}to theBottomSheetcomponent. When embedded inPerpsOrderView(no external sheet ref), this evaluated totrue, causing the BottomSheet infrastructure to callnavigation.goBack()on dismiss — popping the order screen from the navigation stack. The parent'sonClosecallback then fired redundantly.Fix: Set
shouldNavigateBack={false}unconditionally and always pass theonCloseprop 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
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:
Full output (18/18 passed)
Pre-merge author checklist
Pre-merge reviewer checklist
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.
PerpsOrderTypeBottomSheetnow always passesshouldNavigateBack={false}toBottomSheetand always wiresonClose, instead of enablingnavigation.goBack()when no externalsheetRefis provided. Dismissal (tap outside, close, or picking Market/Limit) only runs the parentonClosehandler 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.