Skip to content

feat(ramps): clears input on back button keyboard press#26776

Merged
georgeweiler merged 6 commits into
mainfrom
codex/TRAM-3304-key-input-fix-clean
Mar 2, 2026
Merged

feat(ramps): clears input on back button keyboard press#26776
georgeweiler merged 6 commits into
mainfrom
codex/TRAM-3304-key-input-fix-clean

Conversation

@georgeweiler

@georgeweiler georgeweiler commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Description

This is a small PR based on a feature request from QA. It will clear ramp input if the user clicks the "back button" on the ramp keyboard.

Changelog

CHANGELOG entry: improved keyboard UX for buy feature

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3304

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Medium Risk
Changes amount-entry behavior on the unified buy flow; incorrect handling could break quote fetching/continue enablement for some input sequences. Scope is limited to the BuildQuote keypad interaction and corresponding tests.

Overview
Improves unified-buy amount entry UX by making the first Keypad back/delete press clear the initial default amount (e.g., 1000) instead of deleting a single digit.

Adds a keyboardIsDirty flag in BuildQuote to differentiate the initial default state from user-modified input, and updates handleKeypadChange to special-case pressedKey === Keys.Back.

Updates unit tests to cover the new delete/back behavior and adjusts the unified-buy smoke test to match the new input sequence (single delete, then enter 15).

Written by Cursor Bugbot for commit 9b1f8e6. This will update automatically on new commits. Configure here.

@georgeweiler georgeweiler requested a review from a team as a code owner March 2, 2026 12:55
@github-actions

github-actions Bot commented Mar 2, 2026

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.

@metamaskbot metamaskbot added the team-money-movement issues related to Money Movement features label Mar 2, 2026
@github-actions github-actions Bot added the size-S label Mar 2, 2026
@georgeweiler georgeweiler changed the title feat: clears input on back buttonk keyboard press feat(ramps): clears input on back buttonk keyboard press Mar 2, 2026
Comment thread app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx
@georgeweiler georgeweiler changed the title feat(ramps): clears input on back buttonk keyboard press feat(ramps): clears input on back button keyboard press Mar 2, 2026
Comment on lines 109 to +110
const [userHasEnteredAmount, setUserHasEnteredAmount] = useState(false);
const [keyboardIsDirty, setKeyboardIsDirty] = useState(false);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both of these are needed, despite looking like the same state.

userHasEnteredAmount can become true without any user action (region default). keyboardIsDirty becomes true only after a keypad interaction, which is what we need for “clear only if they haven’t touched the keypad.”

@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeRamps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused entirely on the Ramps (on-ramp/buy crypto) feature:

  1. BuildQuote.tsx: Added a keyboardIsDirty state to improve UX when deleting the default amount. On first delete press, the entire default amount is cleared to '0' instead of requiring multiple delete presses. This is a contained UI behavior change within the BuildQuote component.

  2. BuildQuote.test.tsx: Added unit tests to cover the new delete behavior - testing that delete clears default amount on first press, and works normally after user interaction.

  3. onramp-unified-buy.spec.ts: Updated the E2E test to reflect the new behavior - removed one delete button tap and adjusted the amount entered from '5' to '15' to match the expected '$15.00' assertion.

The changes are well-contained to the Ramps feature with no impact on other wallet functionality. The E2E test file is in the tests/smoke/ramps/ directory which maps directly to the SmokeRamps tag. No other features (confirmations, accounts, networks, trading) are affected by these changes.

Performance Test Selection:
The changes are limited to keypad interaction logic in the BuildQuote component - specifically how the delete key behaves when clearing a default amount. This is a simple state management change that doesn't affect rendering performance, data loading, list rendering, or any performance-critical paths. No performance tests are needed.

View GitHub Actions results

@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 60
Missing keys 0
Type mismatches 0
Value mismatches 6 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@georgeweiler georgeweiler added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit d226f94 Mar 2, 2026
87 checks passed
@georgeweiler georgeweiler deleted the codex/TRAM-3304-key-input-fix-clean branch March 2, 2026 21:29
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-S team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants