-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: on paste error validation #37611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Paste breaks old misspellings on keyboard paste
When pasting via keyboard shortcut (Ctrl+V/Cmd+V), handleOnPaste doesn't clear misSpelledWords before calling onSrpPaste. Since onSrpPaste creates new word objects with new IDs, old misspelled words from previous input remain in state and display incorrect error messages. The paste button flow correctly clears misSpelledWords in onTriggerPaste, but the direct paste handler is missing this cleanup.
ui/components/app/srp-input-import/srp-input-import.tsx#L215-L225
metamask-extension/ui/components/app/srp-input-import/srp-input-import.tsx
Lines 215 to 225 in 1b6ee4e
| const handleOnPaste = ( | |
| clipBoardEvent: React.ClipboardEvent<HTMLTextAreaElement>, | |
| ) => { | |
| clipBoardEvent.preventDefault(); | |
| const newSrp = clipBoardEvent.clipboardData.getData('text'); | |
| if (newSrp.trim().match(/\s/u)) { | |
| clipBoardEvent.preventDefault(); | |
| onSrpPaste(newSrp); | |
| } | |
| }; |
Builds ready [1b6ee4e]
UI Startup Metrics (1198 ± 87 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
LeVinhGithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm QA
Description
In this PR, it immediately validates the pasted SRP by invoking it on paste.
Jira Link: https://consensyssoftware.atlassian.net/browse/SL-279
Changelog
CHANGELOG entry: validate seedphrase when user paste the data.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2025-11-07.at.4.14.21.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Immediately validates pasted SRP words by refactoring the invalid-word checker to accept an SRP list and invoking it on paste.
ui/components/app/srp-input-import/srp-input-import.tsx):checkForInvalidWordsto accept an optionalsrparray, defaulting to currentdraftSrp.checkForInvalidWords(newDraftSrp)during paste handling to flag invalid words immediately after parsing input.Written by Cursor Bugbot for commit 1b6ee4e. This will update automatically on new commits. Configure here.