Skip to content

fix: qr code not rendering on iPad Safari in install modal - #1397

Open
ZayanKhan-12 wants to merge 2 commits into
MetaMask:mainfrom
ZayanKhan-12:fix/1218-ipad-qr-svg-size
Open

ZayanKhan-12 wants to merge 2 commits into
MetaMask:mainfrom
ZayanKhan-12:fix/1218-ipad-qr-svg-size

Conversation

@ZayanKhan-12

@ZayanKhan-12 ZayanKhan-12 commented Aug 4, 2026 •

Copy link
Copy Markdown

Description

Fixes the install modal showing no QR code on iPad (#1218).

Root cause is a two-part failure:

  1. The QR <svg> from encodeQR(link, 'svg', …) carries only a viewBox — no width/height attributes — so its rendered size depends entirely on CSS.
  2. The only sizing rule uses native CSS nesting:
    #sdk-mm-qrcode {
        svg { width: 50%; }
    }
    Native nesting is only supported in Safari 16.5+ (17.2 for the &-less relaxed form). Older iPad Safari drops the whole rule, leaving an SVG with no intrinsic size inside a flex container — which WebKit collapses to 0×0.

The fix un-nests the selector (works in every browser) and adds height: auto; aspect-ratio: 1 / 1 so the square QR keeps its shape. Applied to both style.css and widget-wrapper/resetStyles.css, covering both mm-install-modal and mm-select-modal.

Fixes #1218

Testing

  • yarn workspace @metamask/sdk-install-modal-web build — compiled output now contains #sdk-mm-qrcode svg{width:50%;height:auto;aspect-ratio:1 / 1} (verified in dist)

🤖 Generated with Claude Code


Note

Low Risk
Scoped CSS-only change for modal QR display with no auth, data, or API impact.

Overview
Fixes invisible QR codes in the install and select modals on iPad Safari by replacing nested #sdk-mm-qrcode { svg { … } } rules with a flat #sdk-mm-qrcode svg selector in style.css and resetStyles.css, so sizing applies on browsers that drop unsupported native nesting.

The updated rule keeps 50% width and adds height: auto and aspect-ratio: 1 / 1 so viewBox-only SVGs get a non-zero square layout instead of collapsing in flex. The unreleased changelog notes the fix (#1397).

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

ZayanKhan-12 and others added 2 commits August 3, 2026 20:21
The QR svg emitted by encodeQR has only a viewBox, so its rendered size comes entirely from the stylesheet. That rule used native CSS nesting, which Safari only supports from 16.5/17.2; older iPad Safari drops the rule, leaving an SVG with no intrinsic size inside a flex container, which WebKit collapses to 0x0. Un-nest the selector and add height/aspect-ratio.

Fixes MetaMask#1218

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Install modal QR code Not Displaying on iPad

1 participant