Commit afa22a6
authored
fix(ramp): Add live blinking cursor to ramp amount input (MetaMask#27292)
## **Description**
Adds a live blinking input cursor to the Ramp amount input screen (Buy
and Sell flows), matching the cursor behavior seen in the Swap and Send
screens.
The cursor is purely cosmetic — it blinks next to the amount text to
indicate the input is active. For Buy, the cursor appears after the
amount (e.g. `$100|`). For Sell, the cursor appears before the token
symbol (e.g. `12.5| ETH`). The display now shows the raw amount string
(e.g. `$100`) instead of the formatted value with decimals (e.g.
`$100.00`), providing a cleaner editing experience.
## **Changelog**
CHANGELOG entry: Added a live blinking cursor to the Ramp Buy and Sell
amount input screens for a more intuitive input experience.
## **Related issues**
Refs:
[TRAM-3335](https://consensyssoftware.atlassian.net/browse/TRAM-3335)
## **Manual testing steps**
```gherkin
Feature: Live input cursor on Ramp amount input
Scenario: Buy screen shows blinking cursor after amount
Given the user is in the Buy flow
When the amount input screen is displayed (e.g. "$100")
Then a blinking cursor appears after the amount text
And the cursor is vertically centered with the numerical text
Scenario: Sell screen shows blinking cursor before token symbol
Given the user is in the Sell flow
When the amount input screen is displayed (e.g. "12.5 ETH")
Then a blinking cursor appears between the amount and the token symbol (e.g. "12.5| ETH")
And the cursor does NOT appear after the token symbol
Scenario: Buy screen displays raw amount without trailing decimals
Given the user is in the Buy flow with default amount 100
When the amount input screen is displayed
Then the amount shows "$100" (not "$100.00")
And the cursor blinks after the displayed amount
Scenario: Keypad input works correctly with cursor
Given the user is on the amount input screen
When the user presses keypad digits
Then the amount updates and the cursor remains at the end
And backspace removes the last character as expected
```
## **Screenshots/Recordings**
### **Before**
<!-- Screenshot/video showing static amount display without cursor -->
<img width="355" height="683" alt="Screenshot 2026-03-11 140355"
src="https://github.com/user-attachments/assets/c6e090d6-afa0-4b70-9657-bc7517befda0"
/>
<img width="352" height="676" alt="Screenshot 2026-03-11 140423"
src="https://github.com/user-attachments/assets/9e216129-a228-486f-8a10-e781c282349e"
/>
### **After**
<!-- Screenshot/video showing blinking cursor on Buy and Sell screens
-->
<img width="342" height="626" alt="Screenshot 2026-03-11 132503"
src="https://github.com/user-attachments/assets/91d0fd57-86a3-4438-948d-cfcee011df8e"
/>
https://github.com/user-attachments/assets/8d813b25-e0bb-4efb-900c-881a3a065e81
https://github.com/user-attachments/assets/c469bef2-5864-4571-ae2f-678bdf4c332c
https://github.com/user-attachments/assets/ee150ac8-3028-4155-9cfd-986d534c6c1a
https://github.com/user-attachments/assets/2372e1ea-1f0d-4339-a98c-d53e076bf6e5
## **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
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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]
> **Low Risk**
> Low risk UI-only change that adds a cosmetic blinking cursor and minor
formatting tweaks; main risk is small regressions in amount
display/accessibility labels or snapshot expectations.
>
> **Overview**
> Adds a reusable `useBlinkingCursor` hook and wires it into Ramp amount
entry UIs to render a *cosmetic* blinking cursor.
>
> Updates `Aggregator` `AmountInput` to show the cursor only when
`highlighted`, place it **after the amount for buy** and **before the
token symbol for sell** (new `tokenSymbol` prop), and adds an
`accessibilityLabel` for the amount. Updates unified Ramp `BuildQuote`
to split currency formatting into prefix/suffix and render the amount
with an animated cursor between them.
>
> Extends test IDs and adds/updates unit tests and snapshots to cover
cursor visibility and updated rendering expectations.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ef97f00. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 47741a3 commit afa22a6
12 files changed
Lines changed: 384 additions & 87 deletions
File tree
- app/components/UI/Ramp
- Aggregator
- Views/BuildQuote
- __snapshots__
- components
- __snapshots__
- Views/BuildQuote
- __snapshots__
- hooks
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
777 | 795 | | |
778 | 796 | | |
779 | 797 | | |
| |||
853 | 871 | | |
854 | 872 | | |
855 | 873 | | |
856 | | - | |
| 874 | + | |
857 | 875 | | |
858 | 876 | | |
859 | 877 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
| 998 | + | |
998 | 999 | | |
999 | 1000 | | |
1000 | 1001 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
| 1060 | + | |
1060 | 1061 | | |
1061 | 1062 | | |
1062 | 1063 | | |
| |||
5303 | 5304 | | |
5304 | 5305 | | |
5305 | 5306 | | |
| 5307 | + | |
5306 | 5308 | | |
5307 | 5309 | | |
5308 | 5310 | | |
| |||
8250 | 8252 | | |
8251 | 8253 | | |
8252 | 8254 | | |
| 8255 | + | |
8253 | 8256 | | |
8254 | 8257 | | |
8255 | 8258 | | |
| |||
11281 | 11284 | | |
11282 | 11285 | | |
11283 | 11286 | | |
| 11287 | + | |
11284 | 11288 | | |
11285 | 11289 | | |
11286 | 11290 | | |
| |||
13680 | 13684 | | |
13681 | 13685 | | |
13682 | 13686 | | |
| 13687 | + | |
13683 | 13688 | | |
13684 | 13689 | | |
13685 | 13690 | | |
| |||
16603 | 16608 | | |
16604 | 16609 | | |
16605 | 16610 | | |
| 16611 | + | |
16606 | 16612 | | |
16607 | 16613 | | |
16608 | 16614 | | |
| |||
18975 | 18981 | | |
18976 | 18982 | | |
18977 | 18983 | | |
| 18984 | + | |
18978 | 18985 | | |
18979 | 18986 | | |
18980 | 18987 | | |
| |||
21403 | 21410 | | |
21404 | 21411 | | |
21405 | 21412 | | |
| 21413 | + | |
21406 | 21414 | | |
21407 | 21415 | | |
21408 | 21416 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
83 | 104 | | |
84 | 105 | | |
85 | 106 | | |
| |||
Lines changed: 131 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
| |||
32 | 43 | | |
33 | 44 | | |
34 | 45 | | |
| 46 | + | |
35 | 47 | | |
36 | 48 | | |
37 | 49 | | |
| |||
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| 63 | + | |
51 | 64 | | |
52 | 65 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
67 | 100 | | |
68 | 101 | | |
69 | 102 | | |
70 | 103 | | |
71 | 104 | | |
72 | | - | |
| 105 | + | |
73 | 106 | | |
74 | | - | |
75 | | - | |
| 107 | + | |
76 | 108 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
93 | 114 | | |
94 | | - | |
95 | | - | |
96 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
97 | 168 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
102 | 192 | | |
103 | 193 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
| |||
359 | 361 | | |
360 | 362 | | |
361 | 363 | | |
| 364 | + | |
362 | 365 | | |
363 | 366 | | |
364 | 367 | | |
| |||
476 | 479 | | |
477 | 480 | | |
478 | 481 | | |
| 482 | + | |
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
| |||
0 commit comments