[#270] Added a patched 'environment_indicator_navigation' submodule showing the environment on the Navigation sidebar. - #274
Merged
Conversation
📝 WalkthroughWalkthroughThe ChangesEnvironment indicator integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant DrupalPage
participant EnvironmentIndicatorHook
participant ModuleHandler
participant Account
participant EnvironmentConfig
participant HtmlOutput
DrupalPage->>EnvironmentIndicatorHook: invoke pageAttachments
EnvironmentIndicatorHook->>ModuleHandler: check required modules
EnvironmentIndicatorHook->>Account: check required permissions
EnvironmentIndicatorHook->>EnvironmentConfig: read active environment
EnvironmentIndicatorHook->>DrupalPage: attach library and cache metadata
DrupalPage->>EnvironmentIndicatorHook: invoke preprocessHtml
EnvironmentIndicatorHook->>HtmlOutput: append color CSS variable
EnvironmentIndicatorHook->>HtmlOutput: retain indicator attachments and cache metadata
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #274 +/- ##
========================================
Coverage 89.16% 89.16%
========================================
Files 15 15
Lines 203 203
========================================
Hits 181 181
Misses 22 22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ndicator' submodule.
|
Code coverage (threshold: 80%) Per-class coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #270
Checklist before requesting a review
[#123] Verb in past tense.#123added to descriptionChangedsectionChanged
The environment indicator was invisible on every page. Uninstalling
toolbar(Enable core Navigation module #255) madeToolbarHandler::externalIntegration('toolbar')returnFALSE, soenvironment_indicator_page_top()fell back to rendering its classic full-width strip as the first element of<body>. That strip isposition: static; z-index: 10, while core Navigation's sidebar (fixed,z-index: 501) and top bar (fixed,z-index: 490) both sit attop: 0. Measured as uid 1 at 1280px,document.elementFromPoint(640, 5)returnedASIDE.top-bar- the strip was painted underneath the navigation chrome on both the front-end and admin themes, so no viewport position exposed it.It also cost 28px of dead layout. The strip stayed in document flow while being invisible, pushing every authenticated page down. On the homepage
.ct-headersat at92px; with the strip gone it returns to64px, flush under the top bar.Added
patches/environment-indicator-navigation.patch, which creates anenvironment_indicator_navigationsubmodule insidedrupal/environment_indicator. The submodule shows the active environment as an 8px coloured stripe along the inline-start edge of the Navigation sidebar - the treatment the parent module already applies to Gin's vertical toolbar viaborder-lefton.toolbar-menu-administration. It depends onenvironment_indicatorandnavigation, so no defensive module guards are needed.Kept the favicon colouring alive. The
page_topelement carries theenvironment_indicator/faviconlibrary and thedrupalSettings.environmentIndicatorpayload that recolours the browser tab icon. Setting#accesstoFALSEor unsetting the element would have silently dropped both, so the element is reduced witharray_intersect_key()to its#attachedand#cachekeys instead. Verified in the browser:addFavicon: trueand the favicon rewritten to adata:image/png;base64,...URI.Targeted
.admin-toolbar, which is core Navigation's class - defined incore/modules/navigation/layouts/navigation.html.twig, not the contribadmin_toolbarmodule, which is uninstalled and whose assets never load. Core setsborder-inline-endon that element but neverborder-inline-start, and Gin only setstopandheight, so the property is unclaimed and needs no specificity override. The sidebar isbox-sizing: border-box, so it stays exactly 265px wide andDrupal.displace()offsets are untouched.Namespaced the width property deliberately. The parent module defines
--environment-indicator-border-width: 6pxat:rootin CSS that is still attached, so reusing that name would silently yield 6px. The submodule uses--environment-indicator-navigation-width, defaulting to 8px, and--environment-indicator-navigation-colorfor the colour.Registered the patch in
composer.json,patches.lock.json(viacomposer patches-relock, recorded atdepth: 1) andconfig/default/core.extension.yml. Because the patch only adds files, it applies cleanly across releases - and will fail loudly the moment a release ships its own submodule of this name, which is the signal to drop it.Rewrote
environment_indicator_access.featureand added a computed-style Behat step. The previous scenario asserted the element existed and carried astyleattribute, which passed for the entire period the indicator was invisible. The new assertions compare a computed value that differs by role -8pxfor a site administrator against0pxfor a content author on the same selector - and assert the legacy strip is gone. These cover rendered output, so they hold regardless of where the implementation lives.Navigation support is tracked upstream at #3457688 but ships in no release: the GitLab API confirms
modules/on both4.xand5.0.xcontains onlyenvironment_indicator_toolbarandenvironment_indicator_ui, anddrush pm:liston 4.0.25 discovers only those two submodules. MR !86 targets4.xbut is written against a pre-4.0.25 tree and no longer applies; MR !141 indents the strip past the sidebar horizontally, which does not help because the top bar covers it vertically across the full width. Note that the upstream design renders a named button rather than a stripe, so the two are not visually equivalent.Screenshots
Sidebar detail, zoomed - the 8px environment stripe on the inline-start edge:
Full page, showing the site header now flush under the top bar:
Before / After