Commit 587b966
fix: Close all orders/positions bottom sheet dismissal (MetaMask#22216)
## **Description**
Bug was reported where dismissing the close all positions/orders bottom
sheet was dismissing the bottom sheet, but the overlay would persist.
This made the PerpsHomeScreenView non-interactive and blocked users.
This PR introduces a fix where we properly dismiss the bottom sheet both
via close icon press, as well as externally by pressing the overlay
outside of the sheet.
## **Changelog**
CHANGELOG entry: Fix to close all positions/orders bottom sheet
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2021
## **Manual testing steps**
```gherkin
Feature: Close All and Cancel All bottom sheet overlay dismissal
Scenario: user dismisses Close All bottom sheet by pressing overlay
Given user is on PerpsHomeScreen with open positions
And Close All bottom sheet is displayed with overlay
When user presses outside the bottom sheet on the overlay
Then the bottom sheet dismisses with animation
And the overlay is removed
And PerpsHomeScreen becomes interactive
Scenario: user dismisses Close All bottom sheet by pressing Keep Positions
Given user is on PerpsHomeScreen with open positions
And Close All bottom sheet is displayed with overlay
When user presses "Keep Positions" button
Then the bottom sheet dismisses with animation
And the overlay is removed
And PerpsHomeScreen becomes interactive
Scenario: user dismisses Cancel All bottom sheet by pressing overlay
Given user is on PerpsHomeScreen with open orders
And Cancel All bottom sheet is displayed with overlay
When user presses outside the bottom sheet on the overlay
Then the bottom sheet dismisses with animation
And the overlay is removed
And PerpsHomeScreen becomes interactive
Scenario: user dismisses Cancel All bottom sheet by pressing Keep Orders
Given user is on PerpsHomeScreen with open orders
And Cancel All bottom sheet is displayed with overlay
When user presses "Keep Orders" button
Then the bottom sheet dismisses with animation
And the overlay is removed
And PerpsHomeScreen becomes interactive
```
## **Screenshots/Recordings**
https://github.com/user-attachments/assets/381fcd6c-acd7-4f71-aa29-a4fb2f27450d
## **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**
- [ ] 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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Properly closes the bottom sheet and removes the overlay when
dismissed via overlay tap, close icon, or "Keep" buttons for Close All
Positions and Cancel All Orders.
>
> - **Perps**:
> - **`PerpsCancelAllOrdersView`**:
> - Add `handleKeepButtonPress` to correctly close when used as overlay;
wire to footer `keep_orders` button.
> - Pass `onClose` to `BottomSheet` when `externalSheetRef` is provided;
update all instances (empty/content states).
> - **`PerpsCloseAllPositionsView`**:
> - Add `handleKeepButtonPress` to correctly close when used as overlay;
wire to footer `keep_positions` button.
> - Pass `onClose` to `BottomSheet` when `externalSheetRef` is provided;
update all instances (loading/empty/content states).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
232ec94. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>1 parent 4e9972e commit 587b966
2 files changed
Lines changed: 51 additions & 9 deletions
File tree
- app/components/UI/Perps/Views
- PerpsCancelAllOrdersView
- PerpsCloseAllPositionsView
Lines changed: 23 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
180 | 191 | | |
181 | 192 | | |
182 | 193 | | |
183 | 194 | | |
184 | | - | |
| 195 | + | |
185 | 196 | | |
186 | 197 | | |
187 | 198 | | |
| |||
197 | 208 | | |
198 | 209 | | |
199 | 210 | | |
200 | | - | |
| 211 | + | |
201 | 212 | | |
202 | 213 | | |
203 | 214 | | |
204 | 215 | | |
205 | 216 | | |
206 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
207 | 222 | | |
208 | 223 | | |
209 | 224 | | |
| |||
219 | 234 | | |
220 | 235 | | |
221 | 236 | | |
222 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
223 | 242 | | |
224 | 243 | | |
225 | 244 | | |
| |||
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
207 | 218 | | |
208 | 219 | | |
209 | 220 | | |
210 | 221 | | |
211 | | - | |
| 222 | + | |
212 | 223 | | |
213 | 224 | | |
214 | 225 | | |
| |||
224 | 235 | | |
225 | 236 | | |
226 | 237 | | |
227 | | - | |
| 238 | + | |
228 | 239 | | |
229 | 240 | | |
230 | 241 | | |
231 | 242 | | |
232 | 243 | | |
233 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
234 | 249 | | |
235 | 250 | | |
236 | 251 | | |
| |||
249 | 264 | | |
250 | 265 | | |
251 | 266 | | |
252 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
253 | 272 | | |
254 | 273 | | |
255 | 274 | | |
| |||
265 | 284 | | |
266 | 285 | | |
267 | 286 | | |
268 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
269 | 292 | | |
270 | 293 | | |
271 | 294 | | |
| |||
0 commit comments