-
Notifications
You must be signed in to change notification settings - Fork 0
Fix mobile header fixed position overlap #760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 8.x
Are you sure you want to change the base?
Fix mobile header fixed position overlap #760
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(See latest review below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Superseded)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes Requested: Fix Root Cause
Why Root Cause Analysis Matters
This bug has now spanned 4 PRs (#677→#678→#759→#760). Each iteration adds complexity without resolving the underlying issue. When a bug keeps returning, it signals the need to stop and investigate why rather than applying another patch. The time invested in RCA pays off by preventing future iterations.
The Root Cause
PR #678's body padding uses:
padding-top: calc(var(--dxt-setting-header-mobile-height) + var(--drupal-displace-offset-top, 0))The bug: For anonymous users, Drupal sets --drupal-displace-offset-top to an empty string "", not undefined. CSS fallbacks don't apply to empty strings, so calc(40px + "") is invalid and ignored → 0px padding.
| User Type | CSS Variable | Body Padding | Status |
|---|---|---|---|
| Anonymous | "" (empty) |
0px | ❌ Broken |
| Admin | "83px" |
40px | ✓ Works |
Issues with This PR
- Workaround, not fix - Adds
.wrap-containerspadding while body padding stays broken - Unexplained
3%- Varies by viewport width (CSS % padding is width-based)
Screenshots
The bug is subtle on this landing page due to its hero section styling. Look at the gap between the language switcher bar (teal) and the "Save time" headline:
Without fix — minimal spacing (body padding: 0px):

With PR 760 — more spacing (wrap-containers padding: 55px):

The visual difference is subtle here, but the underlying issue is significant: on pages with page titles or content starting immediately after the header, the 0px body padding causes the fixed header to overlap content when scrolling.
Recommended Fix
// Anonymous/regular users (displacement API returns empty string)
&:has(#navbar.header-mobile-fixed):not(.toolbar-horizontal, .toolbar-vertical, .toolbar-fixed) {
padding-top: var(--dxt-setting-header-mobile-height) !important;
}|
@jjroelofs I fixed it according to your instructions. However, since I didn’t use 3% for On the other hand, when this is used:
there is a proper blue spacing above the top of the letters: If you want, we can leave like it is on first screenshot, or you can give me some advice on what would be wiser to use instead of 3%. |
|
@drale1 Thanks for implementing the root cause fix for the displacement API bug! This PR fixes #762 (displacement bug only). The current fix is correct: padding-top: var(--dxt-setting-header-mobile-height) !important;The spacing issue (3%) is tracked in #763. The visual breathing room between header and page title is a separate enhancement. Please create a new PR for that issue. Once you confirm the current code has no extra spacing (just header height), this PR is ready for approval. |
|
@jjroelofs thanks for the review. |


Partially fixes: #762
Linked issues
Solution
Fixed the root cause of mobile header fixed position issues: Drupal sets
--drupal-displace-offset-topto an empty string for anonymous users, which breaks CSScalc()fallbacks.Changes made:
Note: This PR only fixes the mobile header location. The remaining 2 broken locations documented in #762 require separate PRs:
scss/components/dxpr-theme-header--top.scss:53(overlay header)features/sooper-header/header-theme-settings-css.inc:70(desktop fixed header)Related
Checklist