Skip to content

fix: limit announcement modal height (#307) - #312

Open
kushbosamiya wants to merge 1 commit into
arkade-os:masterfrom
kushbosamiya:fix/limits-announcement-modal
Open

fix: limit announcement modal height (#307)#312
kushbosamiya wants to merge 1 commit into
arkade-os:masterfrom
kushbosamiya:fix/limits-announcement-modal

Conversation

@kushbosamiya

@kushbosamiya kushbosamiya commented Jan 26, 2026

Copy link
Copy Markdown

Fixes #307

Fixes an issue where the blurred section overlaps the component screen on mobile when users zoom in, hiding the CTA buttons.

What’s changed :

  • Limit modal height to the viewport
  • Make the content section scroll when it overflows
  • Keep CTA buttons always visible
image

Summary by CodeRabbit

Release Notes

  • New Features

    • Layout components now support custom style properties for greater flexibility.
    • Modals render with enhanced positioning, layering system, and improved overflow handling for content-heavy dialogs.
  • Improvements

    • Refined visual spacing and alignment across UI components for better visual presentation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request modifies three component files to address announcement modal viewport constraints. It adjusts Announcement icon styling, adds optional style customization to FlexCol, and significantly restructures Modal to use React Portal with height constraints, adjusted z-indices, and scrollable overflow behavior for content exceeding viewport height.

Changes

Cohort / File(s) Summary
Icon & Styling Adjustments
src/components/Announcement.tsx
Width calculation updated from 100% to calc(100% + 2rem) and margin property expanded from marginTop: '-1rem' to margin: '-1rem -1rem 0 -1rem' for horizontal and vertical spacing adjustments.
FlexCol Props Enhancement
src/components/FlexCol.tsx
Added optional style?: React.CSSProperties prop to interface; renamed internal destructuring reference from style to customStyle and merged external styles into computed style object for external override capability.
Modal Portal & Positioning Restructure
src/components/Modal.tsx
Integrated React Portal via createPortal to render modal into document.body. Adjusted z-indices (overlay: 21→80, container: 22→90, inner: new 95). Changed positioning from absolute to fixed. Added inner content wrapper with className 'modal-inner', maxHeight: calc(100vh - 4rem), overflow-y: auto, and pointerEvents: auto to enable scrollable overflow while preserving overlay click-through behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • blured modals #270: Modifies Modal.tsx with related positioning, z-index, and pointer-events adjustments with similar layered overlay/container structural approach.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: limit announcement modal height' directly and clearly describes the main change—limiting modal height to viewport.
Linked Issues check ✅ Passed Code changes successfully address issue #307 requirements: Modal.tsx implements viewport height limiting with scrollable overflow and Portal rendering; FlexCol and Announcement.tsx provide supporting adjustments.
Out of Scope Changes check ✅ Passed Changes to Announcement.tsx, FlexCol.tsx, and Modal.tsx are all directly scoped to fixing the announcement modal height issue and supporting the viewport constraint objective.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.env:
- Line 2: Add a trailing newline to the .env file so it ends with a blank line;
update the file containing the line "GENERATE_SOURCEMAP=false" to ensure a final
newline character is present (POSIX-compliant end-of-file newline).

Comment thread .env Outdated
@@ -1,2 +1,2 @@
CI=false
GENERATE_SOURCEMAP=false
GENERATE_SOURCEMAP=false No newline at end of file

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.

⚠️ Potential issue | 🟡 Minor

Add a trailing newline at the end of the file.

Per static analysis, the file is missing a blank line at the end. Many tools and POSIX conventions expect files to end with a newline.

Proposed fix
 CI=false
-GENERATE_SOURCEMAP=false
+GENERATE_SOURCEMAP=false
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GENERATE_SOURCEMAP=false
GENERATE_SOURCEMAP=false
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 2-2: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)

🤖 Prompt for AI Agents
In @.env at line 2, Add a trailing newline to the .env file so it ends with a
blank line; update the file containing the line "GENERATE_SOURCEMAP=false" to
ensure a final newline character is present (POSIX-compliant end-of-file
newline).

@pietro909

Copy link
Copy Markdown
Contributor

Thank you for your contribution!

The following files seem unrelated to the UI fix, can you please roll them back to simplify the review process?

  • .env
  • public/wallet-service-worker.mjs
  • src/index.css
  • package-lock.json
  • pnpm-workspace.yaml

@bordalix

Copy link
Copy Markdown
Collaborator

Please add link to related issue in PR description:
#307

@kushbosamiya
kushbosamiya force-pushed the fix/limits-announcement-modal branch from b1140dd to 4ac1fc8 Compare January 27, 2026 16:19
@kushbosamiya

Copy link
Copy Markdown
Author

@bordalix Please review the flagged PR when you have time and let me know if there’s anything I should update. Happy to contribute

@Kukks
Kukks requested a review from bordalix February 1, 2026 22:14

@bordalix bordalix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

concept NACK

Instead of scrolling the whole modal content (see attached video) only the middle section (the 3 bullet points) should scroll.

Screen.Recording.2026-02-02.at.14.25.44.mov

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All the changes is this file seem not related to this PR.
Please remove.

Comment thread src/components/Modal.tsx
top: '0',
left: '0',
zIndex: 22, // Higher than overlay
zIndex: 90,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
zIndex: 90,
zIndex: 90, // Higher than overlay

keep comments

Comment thread src/components/Modal.tsx
position: 'absolute' as 'absolute',
pointerEvents: 'none' as 'none', // Allow clicks to pass through to children
position: 'fixed' as 'fixed',
pointerEvents: 'none' as 'none',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pointerEvents: 'none' as 'none',
pointerEvents: 'none' as 'none', // Allow clicks to pass through to children

keep comments

Comment thread src/components/Modal.tsx
border: '1px solid var(--dark10)',
backgroundColor: 'var(--ion-background-color)',
pointerEvents: 'auto' as 'auto', // Enable clicks on the modal content
pointerEvents: 'auto' as 'auto',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pointerEvents: 'auto' as 'auto',
pointerEvents: 'auto' as 'auto', // Enable clicks on the modal content

keep comments

Comment thread src/components/Modal.tsx
}, [])

return (
return createPortal(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to evaluate the usage of createPortal when the app is used with expo (i.e. mobile apps)

@ghost

ghost commented Mar 16, 2026

Copy link
Copy Markdown

👋 Hey @kushbosamiya@bordalix requested changes on this PR back on February 2nd and it's been quiet since. Is this still something you plan to address, or should we close it?

@ghost

ghost commented Mar 19, 2026

Copy link
Copy Markdown

Hey @kushbosamiya — just checking in 👋 @bordalix requested changes a few days ago. Any progress or questions on the feedback? Happy to help unblock if needed.

@ghost

ghost commented Mar 19, 2026

Copy link
Copy Markdown

🔍 Arkana PR Review

PR: wallet#312 — fix: limit announcement modal height (#307)
Author: kushbosamiya | Files: 3 (Announcement.tsx, FlexCol.tsx, Modal.tsx)

Changes

  1. Modal.tsx — Major improvement: uses createPortal(document.body) instead of inline rendering, switches from position: absolute to position: fixed, adds maxHeight: calc(100vh - 4rem) with overflowY: auto for scroll. Z-index bumped from 21/22 to 80/90/95.

  2. Announcement.tsx — Fixes icon gradient banner to span full modal width using negative margins (calc(100% + 2rem), margin: -1rem -1rem 0 -1rem).

  3. FlexCol.tsx — Adds optional style prop for custom CSS overrides, spread into computed styles.

Findings

✅ Portal approach is correct. Using createPortal to document.body eliminates stacking context issues that caused the original bug (modal trapped inside parent overflow).

⚠️ Minor: z-index escalation (nit). Jumping to 80/90/95 is fine now but could clash if other components (e.g., Ionic overlays, which default to z-index 1000+) are layered. Consider documenting the z-index scale or using CSS variables. Not blocking.

⚠️ Minor: overflowY: auto on inner container. This correctly enables scroll when content exceeds viewport. However, the pointerEvents: none on the container div means clicks on the overlay area won't dismiss the modal. If that's intentional (modal requires explicit close), fine. Just noting the UX pattern.

✅ FlexCol style prop — clean addition. Spread is at the end so custom styles properly override computed ones.

✅ No security concerns. No user input handling changes.

Verdict: LGTM — solid fix for the mobile overflow issue. The portal pattern is the right approach.

@ghost

ghost commented Mar 24, 2026

Copy link
Copy Markdown

Hey @kushbosamiya — this PR has had changes requested for about 7 weeks (bordalix's review on Feb 2). Still planning to address the feedback? Happy to help if you're stuck on anything.

@arkana-ai-bot arkana-ai-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — fix/limits-announcement-modal

Blocker: PR cannot be merged (DIRTY state — stale base)

mergeStateStatus: DIRTY. This PR branches from a stale point in master. The local master clone already contains a completely different Modal.tsx (AnimatePresence/Framer-Motion-based, position: fixed throughout, no old inline-only approach) and an already-fixed Announcement.tsx (lines 118–143 already implement maxHeight: '85vh', overflowY: 'auto', and a flex layout that pins the CTA buttons). Merging this PR as-is would discard that entire refactor. Rebase against master first, then re-evaluate what, if anything, remains to be done.


Finding 1 — CTA buttons not actually pinned (stated goal unmet)

src/components/Modal.tsx (new innerStyle, line ~35–42 in the diff):

const innerStyle = {
  ...
  maxHeight: 'calc(100vh - 4rem)',
  display: 'flex',
  flexDirection: 'column',
  overflowY: 'auto',   // ← scrolls everything, including buttons
  ...
}

overflowY: 'auto' is set on the container that holds all children, including the CTA buttons. When content genuinely overflows, the buttons scroll out of view. The PR description says "Keep CTA buttons always visible" but the implementation does not achieve this for long content. The correct pattern (which master's Announcement.tsx:118–143 already uses) is to separate the scrollable content region (flex: '1 1 auto'; minHeight: 0; overflowY: 'auto') from the CTA row (flex-shrink: 0). The fix needs to live in the caller layout, not the Modal wrapper itself — putting scroll on the wrapper forces every caller to compensate.


Finding 2 — Redundant zIndex: 95 on innerStyle

src/components/Modal.tsx (innerStyle):

zIndex: 95,

The containerStyle div (position: fixed; zIndex: 90) already establishes its own stacking context. The inner zIndex: 95 only competes with siblings within that container, of which there are none. It has no effect on the overlay's z-ordering. Remove it to keep the z-index ladder legible.


Finding 3 — PrettyIcon bleed fix is correct

src/components/Announcement.tsxPrettyIcon width: 'calc(100% + 2rem)' + margin: '-1rem -1rem 0 -1rem' correctly compensates for the modal's 1rem padding on each side, bleeding the gradient background to the modal edge. This is the right approach.


Finding 4 — createPortal is the right call

Portalling to document.body correctly escapes the Ionic stacking context that was causing the blur overlay to sit on top of the modal content. No objection here, though the jsdom note in receive-qrcode.test.tsx:327 suggests the test harness already has a workaround pattern — check that createPortal doesn't break existing modal tests (bridge-confirmation.test.tsx).


Finding 5 — Trailing whitespace

src/components/Modal.tsx, containerStyle block: zIndex: 90, and pointerEvents: 'none' as 'none', have trailing spaces. Nit, but clean it up.


Finding 6 — No new tests

No tests are added for the height-constrained scroll behaviour or the createPortal rendering path. After rebase, add a test asserting the modal renders in document.body and that buttons remain in the viewport when content overflows.


Summary

Merge state ❌ DIRTY — rebase required
CTA pinning ❌ Incomplete — buttons still scroll with content
createPortal ✅ Correct approach
PrettyIcon bleed ✅ Correct
FlexCol style escape-hatch ✅ Low risk
Redundant inner zIndex ⚠️ Remove
Test coverage ❌ None added

Rebase against master; after the rebase much of the Modal.tsx work may already be present. Then fix the CTA pinning by keeping overflowY out of the modal wrapper and instead structuring it inside Announcement (or wherever CTA buttons live), following the pattern already in master.

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.

Limits announcement popup to height of the screen

5 participants