Skip to content

Fixed gift page content overlap on window resize#27983

Merged
minimaluminium merged 2 commits into
mainfrom
gift-screen-resize-BER-3673
May 20, 2026
Merged

Fixed gift page content overlap on window resize#27983
minimaluminium merged 2 commits into
mainfrom
gift-screen-resize-BER-3673

Conversation

@minimaluminium
Copy link
Copy Markdown
Member

ref https://linear.app/ghost/issue/BER-3673

The gift page vertically centers its left-column content by computing the available space once on mount and applying it as inline margin-top. On resize the cached offset stayed put, so as the viewport shrank the content was pushed below the available area and the sticky right panel overlapped it.

Recomputes on window resize through a requestAnimationFrame-throttled listener so drag-resizes collapse to one measurement per frame. Tier switches still don't trigger a recompute, so the title and tier picker stay anchored when benefits expand or collapse.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Review Change Stack

Walkthrough

GiftPage's left-column vertical centering now recalculates on mount and on a throttled window resize using requestAnimationFrame, clearing and re-measuring inner marginTop each time and skipping centering on the mobile breakpoint. The portal app package.json version was bumped from 2.68.49 to 2.68.50.

Suggested reviewers

  • sagzy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing gift page content overlap that occurs on window resize events.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem (cached offset on resize causing overlap) and the solution (requestAnimationFrame-throttled resize listener).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gift-screen-resize-BER-3673

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.

@minimaluminium minimaluminium requested a review from mike182uk May 20, 2026 09:15
ref https://linear.app/ghost/issue/BER-3673

The gift page vertically centers its left-column content by computing
the available space once on mount and applying it as inline margin-top.
On resize the cached offset stayed put, so as the viewport shrank the
content was pushed below the available area and the sticky right panel
overlapped it.

Recomputes on window resize through a requestAnimationFrame-throttled
listener so drag-resizes collapse to one measurement per frame. Tier
switches still don't trigger a recompute, so the title and tier picker
stay anchored when benefits expand or collapse.
@minimaluminium minimaluminium force-pushed the gift-screen-resize-BER-3673 branch from 561d27f to 11c21b3 Compare May 20, 2026 09:40
Changelog for v2.68.49 -> 2.68.50:
  - 11c21b3cf6
@minimaluminium minimaluminium enabled auto-merge (squash) May 20, 2026 09:43
Copy link
Copy Markdown
Contributor

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

🧹 Nitpick comments (1)
apps/portal/src/components/pages/gift-page.js (1)

803-807: 💤 Low value

Consider using event.key instead of deprecated keyCode.

The keyCode property is deprecated. While it still works, consider using event.key === 'Enter' for better future compatibility.

♻️ Suggested update
 const handleEmailKeyDown = (event) => {
-    if (event.keyCode === 13 && !isPurchasing) {
+    if (event.key === 'Enter' && !isPurchasing) {
         handlePurchase(event);
     }
 };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/portal/src/components/pages/gift-page.js` around lines 803 - 807, The
handler handleEmailKeyDown uses the deprecated event.keyCode; update it to check
event.key === 'Enter' instead to ensure future compatibility and readability,
e.g., in handleEmailKeyDown keep the same guard for !isPurchasing and call
handlePurchase(event) when event.key === 'Enter'; ensure the event parameter
type (KeyboardEvent) is compatible if using TypeScript/PropTypes and preserve
existing behavior of not triggering while isPurchasing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/portal/src/components/pages/gift-page.js`:
- Around line 803-807: The handler handleEmailKeyDown uses the deprecated
event.keyCode; update it to check event.key === 'Enter' instead to ensure future
compatibility and readability, e.g., in handleEmailKeyDown keep the same guard
for !isPurchasing and call handlePurchase(event) when event.key === 'Enter';
ensure the event parameter type (KeyboardEvent) is compatible if using
TypeScript/PropTypes and preserve existing behavior of not triggering while
isPurchasing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ccf25e9e-441d-4a9a-b87e-dd705b325e84

📥 Commits

Reviewing files that changed from the base of the PR and between 561d27f and 72dffd1.

📒 Files selected for processing (2)
  • apps/portal/package.json
  • apps/portal/src/components/pages/gift-page.js

@minimaluminium minimaluminium merged commit 1fa681c into main May 20, 2026
41 checks passed
@minimaluminium minimaluminium deleted the gift-screen-resize-BER-3673 branch May 20, 2026 10:09
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.

2 participants