Skip to content

fix(mobile-header): offset mobile menu by actual promo banner height - #91

Open
0xskr33p wants to merge 2 commits into
tari-project:mainfrom
0xskr33p:fix/menu-overflow
Open

fix(mobile-header): offset mobile menu by actual promo banner height#91
0xskr33p wants to merge 2 commits into
tari-project:mainfrom
0xskr33p:fix/menu-overflow

Conversation

@0xskr33p

Copy link
Copy Markdown

Description

Replace hardcoded mobile menu top/height offsets with a dynamic CSS custom property (--promo-banner-height) that tracks the actual rendered height of the ASIC promo banner via ResizeObserver. The mobile menu now always starts exactly below the banner regardless of its rendered size.

Motivation and Context

The mobile menu overlay used hardcoded top and height values (40px, 70px, 80px) at specific breakpoints to avoid overlapping the menu items. Because the banner uses min-height and height: auto on mobile, its actual height is dynamic and varies with content and screen width.
Снимок экрана 2026-04-10 в 19 48 52

How Has This Been Tested?

  • Verified the menu positions correctly below the banner across multiple viewport widths.
  • Confirmed ResizeObserver updates the CSS variable when the banner height changes (e.g., on window resize).
  • Confirmed the menu remains scrollable (overflow-y: auto) with the dynamic height.
  • ESLint passed for all modified files.

What process can a PR reviewer use to test or verify this change?

  1. Open the site on a mobile viewport (or use DevTools responsive mode).
  2. Open the mobile menu and confirm it starts directly below the ASIC banner with no overlap or gap.
  3. Resize the browser window and verify the menu adjusts in real time.
  4. Inspect the <html> element in DevTools and confirm --promo-banner-height updates dynamically.

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify.

The original problem was that when opening the mobile menu, the menu items were effectively hidden and not clickable. After the current MR, a visual nuance remains – when the 'About Tari' menu is open on mobile and scrolling appears within the mobile menu, there are a couple of pixels between the ASIC banner and the Tari bar with the close (X) button for closing the mobile menu. I’d fix that a bit later

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces dynamic height calculation for the PromoBanner component using ResizeObserver, which updates a global CSS variable to adjust the MobileHeader position. Review feedback highlights the need to change the CSS variable fallback to 0px to avoid layout gaps when the banner is missing and suggests increasing the mobile menu's top padding to prevent content from being obscured by the header.

Comment thread src/sites/tari-dot-com/ui/Header/MobileHeader/styles.ts Outdated
Comment thread src/sites/tari-dot-com/ui/Header/MobileHeader/styles.ts
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.

1 participant