Skip to content

Fix CSS var() fallback broken for anonymous users Fixes: #762#764

Open
drale1 wants to merge 2 commits into8.xfrom
drale1/8.x/#762-CSS-displacement-API-variable-fallback-broken-for-anonymous-users
Open

Fix CSS var() fallback broken for anonymous users Fixes: #762#764
drale1 wants to merge 2 commits into8.xfrom
drale1/8.x/#762-CSS-displacement-API-variable-fallback-broken-for-anonymous-users

Conversation

@drale1
Copy link
Collaborator

@drale1 drale1 commented Feb 9, 2026

Linked issues

Solution

Fixes CSS displacement API variable fallback broken for anonymous users. The Drupal displacement API sets --drupal-displace-offset-top to an empty string "" for anonymous users (not undefined), which breaks CSS var() fallbacks in calc() expressions. This caused fixed headers to overlap content for anonymous users.

Changes:

  • Split calc() expressions using --drupal-displace-offset-top into separate rules for toolbar vs non-toolbar contexts
  • Mobile fixed header (dxpr-theme-header--mobile.scss): Use header height only for anonymous users, calc() with displacement for toolbar users
  • Desktop overlay header (dxpr-theme-header--top.scss): Use 30px for anonymous users, calc() with displacement for toolbar users
  • Desktop fixed header body padding (header-theme-settings-css.inc): Split into :not(.toolbar-*) rule for anonymous users and separate rules for toolbar classes

Anonymous users now get proper body padding without invalid calc() expressions, while admin users with toolbars continue to use displacement API offsets correctly.

Checklist

  • I have read the CONTRIBUTING.md document.
  • My commit messages follow the contributing standards and style of this project.
  • My code follows the coding standards and style of this project.
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Need to run update.php after code changes
  • Requires a change to end-user documentation.
  • Requires a change to developer documentation.
  • Requires a change to QA tests.
  • Requires a new QA test.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@drale1 drale1 requested a review from jjroelofs February 9, 2026 08:50
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