Skip to content

fix: qr scanner appearing before the confirmations screen cp-7.77.0#30088

Merged
owencraston merged 10 commits into
mainfrom
fix/29949
May 14, 2026
Merged

fix: qr scanner appearing before the confirmations screen cp-7.77.0#30088
owencraston merged 10 commits into
mainfrom
fix/29949

Conversation

@montelaidev

@montelaidev montelaidev commented May 13, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes the issue where the qr scanning appears before the confirmation screen.

Changelog

CHANGELOG entry: fixes the the qr scanner appearing before confirmations page

Related issues

Fixes: #29949

Manual testing steps

  Scenario: QR hardware wallet transaction shows confirmation screen first
    Given the user has a QR hardware wallet account (e.g. Keystone) set up
      And the user is on that QR account in MetaMask
    When the user initiates a send transaction to an address
    Then the confirmation screen is displayed (NOT the QR scanner)
      And the user sees transaction details (amount, recipient, gas)
  Scenario: QR hardware wallet user confirms a transaction
    Given the user is on the confirmation screen for a QR account transaction
    When the user taps "Confirm"
    Then the QR scanner screen appears
      And the app waits for the QR code scan to complete the transaction
  Scenario: QR hardware wallet user rejects a transaction
    Given the user is on the confirmation screen for a QR account transaction
    When the user taps "Reject"
    Then the transaction is cancelled
      And the QR scanner does NOT appear
  Scenario: QR hardware wallet signature request shows confirmation first
    Given the user is on a QR hardware wallet account
    When a dApp requests a signature (personal_sign or eth_signTypedData)
    Then the confirmation screen is displayed
      And the QR scanner does NOT appear until the user taps "Confirm"
  Scenario: QR hardware wallet signature request shows QRInfo after confirm
    Given the user is on the confirmation screen for a QR account signature request
    When the user taps "Confirm"
    Then the QR scanner / QRInfo view is shown
      And the user can scan the QR code to complete signing

Screenshots/Recordings

Before

After

Screen_Recording_20260513_172613_MetaMask.mp4
Screen_Recording_20260514_195337_MetaMask.mp4

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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 confirmation submit flow for QR hardware wallets by adding new state and altering when scanning UI is shown; mistakes could block or prematurely trigger signing for QR accounts. Scope is contained to confirmations/QR hardware paths with updated tests.

Overview
Prevents the QR scanner/QRInfo view from appearing before the confirmations screen by introducing signingConfirmed in QRHardwareContext and only rendering QRInfo when QR signing is active and the user has confirmed.

Updates useConfirmActions so tapping Confirm during an in-progress QR signing session sets signingConfirmed and explicitly shows the scanner, while still delegating to useQrConfirm for QR-hardware accounts; also ensures signingConfirmed is set before executing the default approval/transaction paths.

Adjusts QR confirm UX so useQrConfirm re-shows the awaiting-confirmation bottom sheet when QR signing is already in progress (instead of opening the QRInfo scanner), and updates footer behavior/tests so the button label remains Confirm during QR signing.

Reviewed by Cursor Bugbot for commit 864f724. Bugbot is set up for automated code reviews on this repo. Configure here.

@montelaidev montelaidev self-assigned this May 13, 2026
@montelaidev montelaidev requested a review from a team as a code owner May 13, 2026 09:21
@montelaidev montelaidev added the team-accounts-framework Accounts team label May 13, 2026
@github-actions

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.

@montelaidev montelaidev changed the title fix: qr scanner appearing before the confirmations screen fix: qr scanner appearing before the confirmations screen cp-7.77.0 May 13, 2026
Comment thread app/components/Views/confirmations/hooks/useConfirmActions.ts
@montelaidev montelaidev mentioned this pull request May 13, 2026
10 tasks
@github-actions github-actions Bot added size-M and removed size-S labels May 13, 2026
Comment thread app/components/Views/confirmations/hooks/useConfirmActions.test.ts
Comment thread app/components/Views/confirmations/hooks/useConfirmActions.test.ts Outdated
Comment thread app/components/Views/confirmations/hooks/useConfirmActions.ts
ccharly
ccharly previously approved these changes May 13, 2026

@ccharly ccharly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code LGTM (not tested). Left 1 nit comment, but that's ok IMO!

import PPOMUtil from '../../../../lib/ppom/ppom-util';
import Routes from '../../../../constants/navigation/Routes';
import { MetaMetricsEvents } from '../../../../core/Analytics';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Not sure why this got added? Linter might complain about this 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mobile linter never gonna complain 😄

Comment thread app/components/Views/confirmations/hooks/useConfirmActions.ts
const toAddress = recipientAddress || to;
if (isEvmSendType) {
submitEvmTransaction({
await submitEvmTransaction({

@OGPoyraz OGPoyraz May 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We shouldn't await here, it will prevent mounting of skeleton loader for confirmation

import PPOMUtil from '../../../../lib/ppom/ppom-util';
import Routes from '../../../../constants/navigation/Routes';
import { MetaMetricsEvents } from '../../../../core/Analytics';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mobile linter never gonna complain 😄

OGPoyraz
OGPoyraz previously approved these changes May 13, 2026
gantunesr
gantunesr previously approved these changes May 13, 2026

@gantunesr gantunesr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good

Comment thread app/components/Views/confirmations/hooks/useConfirmActions.ts
@owencraston

Copy link
Copy Markdown
Contributor

@montelaidev Unfortunately I am noticing a few issues still with the send flow.

screen-20260513-134732-1778694348906.mp4
  1. the first time I load the confirmations screen after I configure a send, the button CTA says "Get signature" instead of "Confirm". Clicking "Get signature" skips the first scanning step and goes straight to opening the camera.
  2. I went back an repeated the flow and this time I saw a completely different scanning screen (as a popup which is nicer but it had me confused).
  3. After submitting the transaction I experienced a crash. This crash may be related to testing on a dev build.

@owencraston owencraston left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking until we can confirm that the issues with the send flow are fixed.

@montelaidev montelaidev dismissed stale reviews from gantunesr and OGPoyraz via 43f727f May 14, 2026 00:57

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 43f727f. Configure here.

Comment thread app/components/Views/confirmations/components/footer/footer.tsx
owencraston
owencraston previously approved these changes May 14, 2026
} = useAlerts();
const { onConfirm, onReject } = useConfirmActions();
const { isSigningQRObject, needsCameraPermission } = useQRHardwareContext();
const isQrAccount = useIsConfirmationFromQrAccount();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove this as it will cost an unnecessary execution?

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes in this PR are focused on the QR hardware wallet confirmation flow:

  1. useQrConfirm.ts (CRITICAL): Changed behavior when isSigningQRObject is true - instead of calling setScannerVisible(true) directly (which skipped the QR code display step), it now calls showAwaitingConfirmation() to re-show the awaiting-confirmation bottom sheet that includes the QR code display. This fixes a UX bug where the QR code display was being skipped.

  2. useConfirmActions.ts: Added new QR context values (isSigningQRObject, setScannerVisible, setSigningConfirmed). Added logic: when isSigningQRObject is true during confirm, calls setSigningConfirmed() then setScannerVisible(true). Renamed hardwareConfirmOptions to sharedConfirmOptions (cosmetic).

  3. qr-hardware-context.tsx: Added signingConfirmed state and setSigningConfirmed function to the QR hardware context.

  4. info-root.tsx: Changed condition from if (isSigningQRObject) to if (isSigningQRObject && signingConfirmed) - QRInfo component only renders after the user has confirmed signing (not just when signing is in progress).

  5. footer.tsx: Removed the special "Get Signature" button label override for QR signing objects - the confirm button now shows the standard label.

  6. useSendActions.test.ts: Minor test fix adding async/await.

Tag Selection Rationale:

  • SmokeAccounts: Directly covers QR hardware wallet account management, including adding QR-based hardware wallet accounts and their interaction flows.
  • SmokeConfirmations: Directly covers transaction and signature confirmation flows. The changes modify the confirmation footer, info-root rendering, and the confirm action flow for QR hardware wallet accounts. Both transaction confirmations and signature requests are affected.

No other tags are needed as the changes are scoped to QR hardware wallet confirmation UX - they don't affect browser, swaps, staking, network management, snaps, or other areas.

Performance Test Selection:
The changes are behavioral/UX fixes to the QR hardware wallet confirmation flow - they modify state management and component rendering conditions but don't affect rendering performance, data loading, or any performance-critical paths. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@montelaidev montelaidev added this pull request to the merge queue May 14, 2026
@montelaidev montelaidev removed this pull request from the merge queue due to a manual request May 14, 2026

@gantunesr gantunesr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good and I see from Monte's test that the bug reported yesterday is fixed

Screen_Recording_20260514_195337_MetaMask.mp4

@owencraston owencraston added this pull request to the merge queue May 14, 2026
Merged via the queue into main with commit a9c779f May 14, 2026
102 checks passed
@owencraston owencraston deleted the fix/29949 branch May 14, 2026 15:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Incorrect sequence: QR signature request displayed before send confirmation.

5 participants