Skip to content

Conversation

@Daniel-Cross
Copy link
Contributor

@Daniel-Cross Daniel-Cross commented Mar 27, 2025

Description

When a user copy and pastes a wallet address, they may occasionally copy and paste whitespace in the process. The Text Input will then give a warning to the user stating the "Solana address is invalid", when in reality it's just a whitespace issue.

This PR addresses the issue by trimming the whitespace on blur so the user most likely won't see the error as it will disappear once they press outside of the text input.

Related issues

Fixes: MetaMask/snaps#3257

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

Simulator Screenshot - iPhone 16 Pro - 2025-03-25 at 14 19 16

After

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-03-27.at.16.17.48.mp4

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.

@Daniel-Cross Daniel-Cross added No QA Needed Apply this label when your PR does not need any QA effort. No E2E Smoke Needed team-snaps-platform-deprecated DEPRECATED: please use "team-core-platform" instead (or "team-new-networks" for Solana snap issues) labels Mar 27, 2025
@Daniel-Cross Daniel-Cross self-assigned this Mar 27, 2025
@Daniel-Cross Daniel-Cross requested a review from a team as a code owner March 27, 2025 15:18
@github-actions
Copy link
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-mobile-platform Mobile Platform team label Mar 27, 2025
@sonarqubecloud
Copy link

Comment on lines +64 to +67
if (trimmedText !== value) {
setValue(trimmedText);
handleInputChange(name, trimmedText, form);
}
Copy link
Member

Choose a reason for hiding this comment

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

I left a comment on the issue about this too: I'm not convinced this is a Snaps platform problem, SnapUIInput is a general purpose component and the Snap can always trim the value it gets if it wants.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. team-mobile-platform Mobile Platform team team-snaps-platform-deprecated DEPRECATED: please use "team-core-platform" instead (or "team-new-networks" for Solana snap issues)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

send flow 'to' input should trim white space on pasting wallet address

4 participants