fix: #3620716 Render the white wordmark in the site branding block on dark sections
Issue: https://www.drupal.org/i/3620716
hook_preprocess_block() set site_logo to the black rightup-logo.svg and exposed logo_white only in hook_preprocess_page(). A branding block placed in a Canvas region is never wrapped by page.html.twig, so it had no white-wordmark path at all and could not sit on a dark section.
The block now ships both wordmarks and CSS reveals exactly one, so it works on a light and on a dark section with no new prop. That is deliberate: no prop means no new component version, so none of the recipe's shipped canvas.component.sdc.* configs go stale and no re-export is needed alongside this.
Changes
vartheme_bs5_rightup.theme—hook_preprocess_block()exposeslogo_white,logo_printandlogo_altto the branding block.templates/block/block--system-branding-block.html.twig— renders both wordmarks through the existingnavbar-brandcomponent, distinguished by its existingnavbar_brand_utility_classesprop. No SDC is modified.scss/base/vartheme.base.scss— the reveal rule.css/base/vartheme.base.css— built withyarn theme:buildin DDEV, not hand-edited.
Three things found while verifying, each worth knowing
1. The rule needs !important, and that is not laziness. navbar-brand carries Bootstrap's .d-flex, and every Bootstrap utility is declared !important. A plain display: none on the same element loses to it: the first build measured computed display: flex on the hidden wordmark, and both marks rendered. Overriding a utility on the element it sits on requires !important, so the rule carries it with a comment saying why.
2. The alt text was empty before this change. It measured as " logo", because the template built it as site_name ~ ' logo' and site_name is blank whenever the block is configured to hide the site name. Now resolved in PHP from system.site config through TranslatableMarkup, since the wordmark stands for the site whether or not the name is displayed. Measures "RightUp VBdev 1 logo" on the verification site.
3. The selector list is atoms/section's dark_backgrounds set MINUS bg-secondary. $secondary is #FFFFFF in this theme, so bg-secondary is a light background here and reusing the set verbatim would have flipped the wordmark to white on white. Worth flagging separately: section.twig auto-applies text-white on a bg-secondary section, which is white text on a white background. That is a pre-existing bug, out of scope here.
Verification
Verified logged out in a real browser (Playwright) on a Varbase 11 / Drupal 11.0.x-dev site at 5dd414e6, asserting computed styles rather than class names:
| Assertion | Result |
|---|---|
| Light section, light wordmark | display: flex, visible |
| Light section, dark wordmark | display: none, not visible |
Inside .bg-black, light wordmark |
display: none, not visible |
Inside .bg-black, dark wordmark |
display: flex, visible |
| State restores when the class is removed | yes |
| Both SVGs load | naturalWidth > 0 on each |
alt on both |
"RightUp VBdev 1 logo" |
| Hidden wordmark out of tab order | offsetParent === null |
| Visible front-page links in the block | 1, so the duplicate link is never reachable |
Console: 4 errors, all drimage_improved_focal_* derivative 404s on demo content images, unrelated to this change. php -l clean, stylelint clean on the generated CSS. phpcs is not installed in that project, so it was not run — only php -l and stylelint.
Scope
The header page region going dark is a recipe-side follow-up to rightup!8 (merged), which deliberately left the header light and named this theme limitation as the reason. This MR removes that blocker; it does not flip the header itself.
AI-Generated: Yes
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
- UX/UI designer responsibilities
- Readability
- Accessibility
- Performance
- Security
- Developer Documentation
- User Guide Documentation
- Reviewed by human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release