Commit a4bbe61
authored
fix(perps): recent activity: only ">" is tappable (#42676)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Fixes the Perps Recent activity affordance so the full header row is
tappable on both the Perps tab and Perp market detail page. Previously
only the arrow icon was inside the button target.
## **Changelog**
CHANGELOG entry: Fixed a bug that made only the Recent activity arrow
tappable in Perps.
## **Related issues**
Fixes:
[TAT-3077](https://consensyssoftware.atlassian.net/browse/TAT-3077)
## **Manual testing steps**
1. Open MetaMask and go to the Perps tab with recent activity.
2. Click the Recent activity header text, not just the arrow.
3. Confirm the Perps activity page opens.
4. Open a Perp market detail page with recent activity.
5. Click the Recent activity header text and confirm the Perps activity
page opens.
## **Screenshots/Recordings**
<table>
<tr><td align="center" width="50%"><strong>Screenshots/evidence Ac1
Perps Recent Activity Row 1778746896456</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/evidence-ac1-perps-recent-activity-row-1778746896456.png"
alt="Screenshots/evidence Ac1 Perps Recent Activity Row 1778746896456"
width="400" /></td><td align="center"
width="50%"><strong>Screenshots/evidence Ac1 Perps Recent Activity Row
1778747064138</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/evidence-ac1-perps-recent-activity-row-1778747064138.png"
alt="Screenshots/evidence Ac1 Perps Recent Activity Row 1778747064138"
width="400" /></td></tr>
<tr><td align="center" width="50%"><strong>Screenshots/evidence Ac2
Market Recent Activity Row 1778746896956</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/evidence-ac2-market-recent-activity-row-1778746896956.png"
alt="Screenshots/evidence Ac2 Market Recent Activity Row 1778746896956"
width="400" /></td><td align="center"
width="50%"><strong>Screenshots/evidence Ac2 Market Recent Activity Row
1778747064585</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/evidence-ac2-market-recent-activity-row-1778747064585.png"
alt="Screenshots/evidence Ac2 Market Recent Activity Row 1778747064585"
width="400" /></td></tr>
<tr><td align="center" width="50%"><strong>Screenshots/long Position ETH
1778746895492</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/long-position-ETH-1778746895492.png"
alt="Screenshots/long Position ETH 1778746895492" width="400"
/><br/><sub>caption confidence: LOW — generic filename — no
state-specific suffix</sub></td><td align="center"
width="50%"><strong>Screenshots/long Position ETH
1778747063131</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/long-position-ETH-1778747063131.png"
alt="Screenshots/long Position ETH 1778747063131" width="400"
/><br/><sub>caption confidence: LOW — generic filename — no
state-specific suffix</sub></td></tr>
<tr><td align="center" width="50%"><strong>Screenshots/perps Tab
1778746896035</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/perps-tab-1778746896035.png"
alt="Screenshots/perps Tab 1778746896035" width="400"
/><br/><sub>caption confidence: LOW — generic filename — no
state-specific suffix</sub></td><td align="center"
width="50%"><strong>Screenshots/perps Tab
1778747063678</strong><br/><img
src="https://raw.githubusercontent.com/abretonc7s/mm-extension-farm-artifacts/main/fixes/42676/screenshots/perps-tab-1778747063678.png"
alt="Screenshots/perps Tab 1778747063678" width="400"
/><br/><sub>caption confidence: LOW — generic filename — no
state-specific suffix</sub></td></tr>
</table>
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/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.
## **Validation Recipe**
<details><summary>recipe.json</summary>
```json
{
"title": "TAT-3077 — Recent activity header rows are fully tappable",
"description": "Validates that the left side of the Recent activity header row is inside the tappable ButtonBase on the Perps tab and Perp market detail page.",
"schema_version": 1,
"validate": {
"workflow": {
"pre_conditions": ["wallet.unlocked", "perps.feature_enabled"],
"entry": "setup-open-position",
"nodes": {
"setup-open-position": {
"action": "call",
"ref": "perps/open-long-position",
"params": { "symbol": "ETH", "side": "long", "amount": "10" },
"next": "setup-nav-perps-tab"
},
"setup-nav-perps-tab": {
"action": "call",
"ref": "perps/navigate-perps-tab",
"next": "ac1-wait-recent-activity"
},
"ac1-wait-recent-activity": {
"action": "wait_for",
"test_id": "perps-recent-activity-see-all",
"timeout_ms": 10000,
"next": "ac1-scroll-recent-activity"
},
"ac1-scroll-recent-activity": {
"action": "scroll",
"test_id": "perps-recent-activity-see-all",
"next": "ac1-assert-row-hit-target"
},
"ac1-assert-row-hit-target": {
"action": "eval_sync",
"expression": "(function(){var testId='perps-recent-activity-see-all';var btn=document.querySelector('[data-testid=\"'+testId+'\"]');if(!btn){return JSON.stringify({ok:false,reason:'missing button'});}var parent=btn.parentElement||btn;var parentRect=parent.getBoundingClientRect();var btnRect=btn.getBoundingClientRect();var probeX=parentRect.left+Math.min(40,parentRect.width/4);var probeY=btnRect.top+(btnRect.height/2);var hit=document.elementFromPoint(probeX,probeY);var target=hit&&hit.closest('[data-testid=\"'+testId+'\"]');return JSON.stringify({ok:target===btn,buttonWidth:Math.round(btnRect.width),rowWidth:Math.round(parentRect.width),probeX:Math.round(probeX),probeY:Math.round(probeY),hitTestId:(target&&target.getAttribute('data-testid'))||(hit&&hit.getAttribute&&hit.getAttribute('data-testid'))||null});})()",
"assert": { "operator": "eq", "field": "ok", "value": true },
"save_as": "ac1_hit_target",
"next": "ac1-screenshot-recent-activity-row"
},
"ac1-screenshot-recent-activity-row": {
"action": "screenshot",
"filename": "evidence-ac1-perps-recent-activity-row",
"note": "AC1: Perps tab Recent activity header row is visible after hit-target assertion",
"next": "setup-nav-market-detail"
},
"setup-nav-market-detail": {
"action": "call",
"ref": "perps/navigate-to-market-detail",
"params": { "symbol": "ETH" },
"next": "ac2-wait-recent-activity"
},
"ac2-wait-recent-activity": {
"action": "wait_for",
"test_id": "perps-market-detail-view-all-activity",
"timeout_ms": 10000,
"next": "ac2-scroll-recent-activity"
},
"ac2-scroll-recent-activity": {
"action": "scroll",
"test_id": "perps-market-detail-view-all-activity",
"next": "ac2-assert-row-hit-target"
},
"ac2-assert-row-hit-target": {
"action": "eval_sync",
"expression": "(function(){var testId='perps-market-detail-view-all-activity';var btn=document.querySelector('[data-testid=\"'+testId+'\"]');if(!btn){return JSON.stringify({ok:false,reason:'missing button'});}var parent=btn.parentElement||btn;var parentRect=parent.getBoundingClientRect();var btnRect=btn.getBoundingClientRect();var probeX=parentRect.left+Math.min(40,parentRect.width/4);var probeY=btnRect.top+(btnRect.height/2);var hit=document.elementFromPoint(probeX,probeY);var target=hit&&hit.closest('[data-testid=\"'+testId+'\"]');return JSON.stringify({ok:target===btn,buttonWidth:Math.round(btnRect.width),rowWidth:Math.round(parentRect.width),probeX:Math.round(probeX),probeY:Math.round(probeY),hitTestId:(target&&target.getAttribute('data-testid'))||(hit&&hit.getAttribute&&hit.getAttribute('data-testid'))||null});})()",
"assert": { "operator": "eq", "field": "ok", "value": true },
"save_as": "ac2_hit_target",
"next": "ac2-screenshot-recent-activity-row"
},
"ac2-screenshot-recent-activity-row": {
"action": "screenshot",
"filename": "evidence-ac2-market-recent-activity-row",
"note": "AC2: Market detail Recent activity header row is visible after hit-target assertion",
"next": "teardown-done"
},
"teardown-done": {
"action": "end",
"status": "pass"
}
}
}
}
}
```
</details>
## **Recipe Workflow**
<details><summary>workflow.mmd</summary>
```mermaid
flowchart TD
%% TAT-3077 — Recent activity header rows are fully tappable
__entry__(["ENTRY"]) --> node_setup_open_position
node_setup_open_position[["setup-open-position<br/>perps/open-long-position"]]
node_setup_nav_perps_tab[["setup-nav-perps-tab<br/>perps/navigate-perps-tab"]]
node_ac1_wait_recent_activity["ac1-wait-recent-activity<br/>wait_for"]
node_ac1_scroll_recent_activity["ac1-scroll-recent-activity<br/>scroll"]
node_ac1_assert_row_hit_target["ac1-assert-row-hit-target<br/>eval_sync"]
node_ac1_screenshot_recent_activity_row["ac1-screenshot-recent-activity-row<br/>screenshot"]
node_setup_nav_market_detail[["setup-nav-market-detail<br/>perps/navigate-to-market-detail"]]
node_ac2_wait_recent_activity["ac2-wait-recent-activity<br/>wait_for"]
node_ac2_scroll_recent_activity["ac2-scroll-recent-activity<br/>scroll"]
node_ac2_assert_row_hit_target["ac2-assert-row-hit-target<br/>eval_sync"]
node_ac2_screenshot_recent_activity_row["ac2-screenshot-recent-activity-row<br/>screenshot"]
node_teardown_done(["teardown-done<br/>PASS"])
node_setup_open_position --> node_setup_nav_perps_tab
node_setup_nav_perps_tab --> node_ac1_wait_recent_activity
node_ac1_wait_recent_activity --> node_ac1_scroll_recent_activity
node_ac1_scroll_recent_activity --> node_ac1_assert_row_hit_target
node_ac1_assert_row_hit_target --> node_ac1_screenshot_recent_activity_row
node_ac1_screenshot_recent_activity_row --> node_setup_nav_market_detail
node_setup_nav_market_detail --> node_ac2_wait_recent_activity
node_ac2_wait_recent_activity --> node_ac2_scroll_recent_activity
node_ac2_scroll_recent_activity --> node_ac2_assert_row_hit_target
node_ac2_assert_row_hit_target --> node_ac2_screenshot_recent_activity_row
node_ac2_screenshot_recent_activity_row --> node_teardown_done
```
</details>
[TAT-3077]:
https://consensyssoftware.atlassian.net/browse/TAT-3077?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk UI-only change that wraps the header row in a single
`ButtonBase` and updates tests; no business logic or data handling is
modified.
>
> **Overview**
> Fixes the Perps *Recent Activity* affordance by making the entire
header row (text + arrow) a single clickable `ButtonBase` that navigates
to `PERPS_ACTIVITY_ROUTE`, in both `PerpsRecentActivity` and
`PerpsMarketRecentActivity`.
>
> Updates accessibility (`aria-label`) and styling to keep full-width
button behavior (including explicit horizontal padding on the market
detail header), and extends unit tests to assert header-text clicks
navigate correctly (switching to `userEvent` where needed).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e58c33d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent ee2119a commit a4bbe61
4 files changed
Lines changed: 67 additions & 48 deletions
File tree
- ui/components/app/perps
- perps-market-recent-activity
- perps-recent-activity
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
200 | 204 | | |
201 | 205 | | |
202 | 206 | | |
| |||
214 | 218 | | |
215 | 219 | | |
216 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
217 | 236 | | |
218 | 237 | | |
219 | 238 | | |
| |||
Lines changed: 24 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
97 | 95 | | |
98 | 96 | | |
99 | 97 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
254 | 267 | | |
255 | 268 | | |
256 | 269 | | |
| |||
Lines changed: 11 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
143 | 140 | | |
144 | 141 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
158 | 148 | | |
159 | 149 | | |
160 | 150 | | |
| |||
0 commit comments