Skip to content

fix: modal height overflowing the screen, qr padding, size and remove show qr button when clicked#376

Merged
rolznz merged 1 commit intomasterfrom
fix/modal-height
Feb 18, 2026
Merged

fix: modal height overflowing the screen, qr padding, size and remove show qr button when clicked#376
rolznz merged 1 commit intomasterfrom
fix/modal-height

Conversation

@rolznz
Copy link
Collaborator

@rolznz rolznz commented Feb 18, 2026

Fixes #363

Summary by CodeRabbit

  • Bug Fixes
    • Modal content now displays vertically and scrolls properly when exceeding available space
    • Improved payment option button visibility to prevent overlaps with QR display
    • QR code rendering scale optimized for better visual clarity

@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

The changes address a mobile UX issue where QR codes appeared too large and control buttons remained visible. Modifications include reducing QR generation scale, conditionally hiding the "Copy & Display Invoice" button when QR is displayed, and making modal content vertically stacked with scrolling capability.

Changes

Cohort / File(s) Summary
Modal Layout & Scrolling
src/components/bc-modal.ts
Changed modal content container from horizontally-centered flex layout to vertical stack using flex-col, added height constraint (max-h-[90vh]) and scrolling (overflow-y-auto) to enable internal content scrolling.
QR Code & Button Rendering
src/components/pages/bc-send-payment.ts
Reduced QR generation scale from 4 to 2, conditionally hid "Copy & Display Invoice" button when QR is visible, and wrapped QR section in a margin container conditionally.
Trivial Updates
dev/vite/index.html
Added inline comments to ln.requestInvoice call parameters; no functional changes to runtime behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A modal now scrolls with graceful ease,
QR codes shrink to fit and please,
Buttons hide when their time has passed,
Mobile screens stay uncompressed at last!
Hop hop!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: modal height fix, QR padding/size reduction, and hiding the show QR button when clicked.
Linked Issues check ✅ Passed All requirements from issue #363 are met: QR size reduced (scale 4→2), QR button hidden when shown (_showQR guard), and modal height constrained (max-h-[90vh] with scrolling).
Out of Scope Changes check ✅ Passed All changes are scoped to fixing issue #363. The modal layout change, QR scaling, button visibility logic, and comment addition in dev/vite/index.html are all related to the stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/modal-height

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/pages/bc-send-payment.ts (1)

223-227: ⚠️ Potential issue | 🟡 Minor

scale=2 shrinks the desktop QR unnecessarily — consider a CSS-constrained approach instead.

renderQR() is shared between the mobile and desktop paths. On desktop, the QR was previously 260×260 CSS px (scale=4); it's now 130×130 CSS px. Since the canvas has no CSS width/height set, the intrinsic size is the rendered size. 130 CSS px is likely too small to scan reliably at typical arm's-length distance from a desktop monitor.

A better fix keeps the intrinsic buffer at scale=4 (better sampling for scanner apps) and constrains the rendered size via CSS:

🔧 Proposed fix — CSS-constrained size instead of shrinking the buffer
-      const scale = 2;
+      const scale = 4;
       canvas.width = moduleCount * scale;
       canvas.height = moduleCount * scale;

Then add a max-width to the canvas element so it never overflows the mobile modal while still appearing at full size on desktop:

-        <canvas id="qr" class="dark:bg-white dark:p-4"></canvas>
+        <canvas id="qr" class="dark:bg-white dark:p-4 max-w-full" style="max-width: 220px;"></canvas>

max-w-full ensures it shrinks within any constrained container, and the inline max-width acts as the absolute cap (tune the value as needed).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/pages/bc-send-payment.ts` around lines 223 - 227, The QR
rendering is using scale=2 which reduces the intrinsic canvas size and makes
desktop QR too small; change the scale constant used in
qr.renderTo2dContext(ctx, scale) from 2 to 4 to keep a higher-resolution buffer,
and instead constrain the displayed size via CSS on the canvas element (e.g.,
add a responsive utility class like "max-w-full" and an absolute cap such as an
inline max-width of "260px" or equivalent styling) so mobile modal layout is
respected while desktop renders at full readable size.
🧹 Nitpick comments (1)
dev/vite/index.html (1)

43-47: Optional: clean up the commented-out comment field in the dev harness.

No runtime impact since it's a dev-only file, but the Lorem Ipsum block is clearly leftover from local testing.

🧹 Proposed cleanup
-            const payButtonInvoice = await ln.requestInvoice({
-              satoshi: 1,
-              //comment:
-              //  "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s",
-            });
+            const payButtonInvoice = await ln.requestInvoice({satoshi: 1});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dev/vite/index.html` around lines 43 - 47, Remove the leftover commented-out
"comment" block inside the ln.requestInvoice call used to create
payButtonInvoice in the dev harness; specifically edit the payButtonInvoice =
await ln.requestInvoice({...}) invocation to delete the commented Lorem Ipsum
lines so only the active fields (e.g., satoshi: 1) remain, keeping the dev UI
code clean.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/pages/bc-send-payment.ts`:
- Around line 223-227: The QR rendering is using scale=2 which reduces the
intrinsic canvas size and makes desktop QR too small; change the scale constant
used in qr.renderTo2dContext(ctx, scale) from 2 to 4 to keep a higher-resolution
buffer, and instead constrain the displayed size via CSS on the canvas element
(e.g., add a responsive utility class like "max-w-full" and an absolute cap such
as an inline max-width of "260px" or equivalent styling) so mobile modal layout
is respected while desktop renders at full readable size.

---

Nitpick comments:
In `@dev/vite/index.html`:
- Around line 43-47: Remove the leftover commented-out "comment" block inside
the ln.requestInvoice call used to create payButtonInvoice in the dev harness;
specifically edit the payButtonInvoice = await ln.requestInvoice({...})
invocation to delete the commented Lorem Ipsum lines so only the active fields
(e.g., satoshi: 1) remain, keeping the dev UI code clean.

@rolznz rolznz merged commit f4119bc into master Feb 18, 2026
3 checks passed
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.

On mobile, QR code is way too large and show QR button is still displayed

1 participant