Work rail: constrain to the content shell, fix jQuery error and scroll affordance (step 13)#27
Merged
Merged
Conversation
The client work rail was the only homepage section still outside a
spine-section, and it carried align="full". At full viewport width all five
cards fit side by side, so the rail-mode scroll-snap container had nothing to
overflow and never scrolled — reported as a broken slider rather than as a
layout gap. Wrapping it in a tinted spine-section ("Selected work") and
dropping the alignment constrains it to the ~820px content column, which
restores the mockup's proportions and the scrolling in one move.
Doing that surfaced a latent spine-section bug: the single-column mobile
track was a bare 1fr, i.e. minmax(auto, 1fr), whose automatic minimum is the
track's min-content width. An overflowing child widened the track and the
whole document instead of being cropped, so the rail made the page scroll
sideways on a phone. Floored at 0 like the desktop track.
Release 2.23.1.
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Two frontend defects on the rail-mode homepage.
view.js was declared as a block.json viewScript, and core enqueues a
viewScript whenever the block is on the page — it has no way to know the
block came in rail mode. The script opens with (function($){...})(jQuery),
so it threw "Can't find variable: jQuery" before reaching its own rail
guard, and jQuery wasn't loaded because the generated view.asset.php
declared no dependencies. It now enqueues from aludra.php behind
aludra_blocks_have_slick_carousel(), the same gate as the Slick vendor
assets, which finally makes good on 2.21.1's promise that a rail-only page
loads no carousel JS at all. Moved to blocks/carousel/js/ since dropping
viewScript also drops it as a webpack entry, and it needs no bundling.
Rail mode also had no visible cue that it scrolled: it draws no arrows and
no dots, and macOS overlay scrollbars reserve no layout space and stay
hidden until you already scrolled (measured offsetHeight - clientHeight ===
0 on the demo site; styling ::-webkit-scrollbar did not override the
platform default). Added a right-edge fade that clears itself at the end of
the track via a scroll-driven animation, and a mono hint label authored as
a paragraph in the pattern. Both pure CSS — rail mode stays zero-JS.
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.
Step 13 of the Aviendha redesign, plus two frontend defects it surfaced on the demo homepage.
1. The rail was full-bleed and "the slider didn't work"
Two symptoms, one cause. Reported as the SVGs are small and there's no slider. The work section was the only one still outside a spine-section, and the carousel carried
align: "full"— so at full viewport width all five cards fit side by side, the rail-mode scroll-snap container had nothing to overflow, and it never scrolled. The cards were always the mockup'sminmax(19rem, 22rem); they only looked undersized against ~500px of dead space either side.The work section now sits in a tinted
aludra/spine-section("Selected work"), matching the mockup's.section.section-tint > .shell > .spine, and the carousel dropped its alignment. Constraining it to the ~820px spine content column fixes the proportions and restores the scrolling in one move.2.
ReferenceError: Can't find variable: jQueryview.jswas declared as a block.jsonviewScript. Core enqueues a viewScript whenever the block is on the page — it has no way to know the block came in rail mode. The script opens with( function ( $ ) { … } )( jQuery ), so it died on that line before ever reaching its own rail guard, and jQuery wasn't loaded because the generatedview.asset.phpdeclared no dependencies.It is now enqueued from
aludra.phpbehindaludra_blocks_have_slick_carousel()— the same gate as the Slick vendor assets — which finally makes good on 2.21.1's stated promise: a rail-only page now loads no carousel JavaScript, not just no Slick. Confirmed on the demo page: the only remaining scripts are core navigation and faq-tabs.The file moved to
blocks/carousel/js/view.js, because droppingviewScriptfrom block.json also drops it as a webpack entry point — and it needs no bundling: hand-written jQuery, no imports. Recorded in CLAUDE.md so the next per-engine gating follows the same shape.3. No visible cue that the rail scrolls
Rail mode draws no arrows and no dots, so the scrollbar was the only affordance — and on macOS that's an overlay scrollbar: zero layout space, invisible until you're already scrolling. Styling
::-webkit-scrollbaris documented to opt into a classic bar but did not override the platform default here (measuredoffsetHeight - clientHeight === 0on the live page).Added instead, both pure CSS so rail mode stays zero-JS:
mask-imageon the scroll container. A mask applies to the element as rendered, so it stays pinned to the edge where an absolutely positioned child of a scroll container would scroll away — and it needs no background color to fade against, so it works in tinted and untinted sections alike. It clears itself at the end of the track via a scroll-driven animation (animation-timeline: scroll(self inline)), so the last card isn't left permanently ghosted; browsers without scroll-driven animations keep a constant fade..aludra-rail-hintclass for a mono "Scroll for more →" label, authored as a paragraph in the pattern rather than a pseudo-element — a::afteron the rail would either become an extra grid column or scroll out of view, and as real content it stays translatable and removable by the page author.4. Latent spine-section bug this surfaced
The single-column mobile layout used a bare
1frtrack. That'sminmax(auto, 1fr), whose automatic minimum is the track's min-content width — so a horizontally overflowing child widens the track, and with it the document, instead of being cropped. The rail made the whole page scroll sideways on a phone (full-page screenshot came back 1384px wide on a 390px viewport). Nowminmax(0, 1fr), matching the desktop track, which had already been floored at 0 for exactly this reason. Any wide child was affected — a table, apre— not just this carousel.Verification
npm run validate:file -- patterns/page-homepage.php→ PASS (re-run after the hint paragraph was added)clientWidth 936 / scrollWidth 1664(overflows and scrolls),--aludra-rail-fadeanimates3rem → 0remacross the scroll range, zero page errors.Released as 2.23.1.