fix(bridge): support cursor-aware custom slippage input#27920
Conversation
|
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. |
c0a13c5 to
250e552
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes improve the UX of the custom slippage input in the Bridge flow (cross-chain bridging), allowing users to edit at specific cursor positions rather than always appending. The changes are low-risk UI refinements with no impact on core logic, controllers, navigation, or shared components. SmokeTrade is selected because the Bridge cross-chain feature is directly affected (slippage modal is part of the bridge flow). No other tags are warranted as the changes don't touch accounts, identity, network management, snaps, ramps, or any other feature areas. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|




Description
This PR makes the custom slippage modal cursor-aware. It adds a dedicated slippage cursor hook that reuses the shared raw cursor editing utilities, wires controlled
selection/onSelectionChangethroughInputStepper, preserves the existing slippage-specific max and decimal validation rules, resets cursor state when the stepper buttons change the value, and sanitizes trailing decimals such as2.before saving the selected slippage.Changelog
CHANGELOG entry: Fixed custom slippage input so keypad edits respect cursor placement and trailing decimals are sanitized before saving.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches user input/editing logic in the Bridge slippage flow (cursor mapping + keypad handling), which can introduce subtle edge-case regressions, but scope is localized and covered by new tests.
Overview
Makes the Bridge
CustomSlippageModalcursor-aware by introducinguseCustomSlippageCursor, which tracks and maps selection between formatted and raw values and applies keypad edits at the current caret position (while preserving max/decimal validation and over-max flagging).Extends
InputStepperto accept controlledselection/onSelectionChange, wires these through the slippage modal, resets cursor state when +/- stepper buttons adjust the value, and sanitizes trailing decimals (e.g.,2.->2) before dispatchingsetSlippage. Tests are updated/added to cover cursor insertion/backspace behavior, trailing-decimal sanitization, and the new selection plumbing.Written by Cursor Bugbot for commit b963576. This will update automatically on new commits. Configure here.