[#308] Fixed sticky header offset when site alerts are present. - #309
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe page now renders sticky headers through a page-level rail. Styles account for administration chrome and mobile navigation. Behat coverage verifies alert ordering, scrolling behavior, viewport pinning, and stacking selectors. ChangesSticky header behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant FeatureContext
participant Browser
participant page.twig
participant page.scss
FeatureContext->>Browser: Navigate to the homepage and scroll to the footer
page.twig->>Browser: Render the sticky header wrapper
Browser->>page.scss: Apply rail and stacking styles
FeatureContext->>Browser: Read the header bounding rectangle
Browser-->>FeatureContext: Return the viewport-top offset
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 phpcs (3.13.6)tests/behat/bootstrap/FeatureContext.phpERROR: Referenced sniff "Drupal" does not exist. Run "phpcs --help" for usage information 🔧 Stylelint (17.14.0)web/themes/custom/drevops/components/04-templates/page/page.scssConfigurationError: Could not find " Comment |
|
Code coverage (threshold: 80%) Per-class coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #309 +/- ##
========================================
Coverage 84.51% 84.51%
========================================
Files 26 26
Lines 562 562
========================================
Hits 475 475
Misses 87 87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #308
Checklist before requesting a review
[#123] Verb in past tense.#123added to descriptionChangedsectionChanged
.ct-header--sticky'sposition: fixed(with notop, so it painted at its static position and never moved on scroll) with a zero-heightposition: stickyrail,.ct-page__header--sticky, wrapped around the header inpage.twig.top: var(--drupal-displace-offset-top, 0)so it sits below core Navigation's administration top bar (published viaDrupal.displace()) instead of underneath it.z-indexand its:has([data-flyout-expanded])mobile-flyout lift onto the rail, sinceposition: stickyalways creates its own stacking context;.ct-header--stickynow only carries its transparency and backdrop-blur treatment.admin_navigation.feature's two stacking assertions from.ct-header--stickyto.ct-page__header--sticky, where the z-index now lives.tests/behat/features/sticky_header.feature, which publishes a site-wide alert, loads the homepage, confirms the alert renders ahead of the header, scrolls to the footer, and asserts the header is flush with the top of the window.the element :selector should be pinned to the top of the viewportstep inFeatureContext.php, since the existing behat-steps "at the top of the viewport" step accepts any offset up to the viewport height and passes on the broken build.Verified in the browser at desktop and mobile widths, with and without an alert, as an anonymous visitor and as an administrator, and with the mobile navigation flyout open. The new scenario was checked both ways: it fails against the old CSS with
Expected element ".ct-header" to be pinned to the top of the viewport, but it is 266px from it.and passes against the fix.Screenshots
Before / After
Before:
.ct-header--stickyisposition: fixedwith notop(defaults toauto)After: positioning moves to a zero-height sticky rail around the header