Skip to content

Build Search template (LS-2594) - #43

Open
brandonmarshal wants to merge 8 commits into
developfrom
feature/ls-2594-search-template
Open

Build Search template (LS-2594)#43
brandonmarshal wants to merge 8 commits into
developfrom
feature/ls-2594-search-template

Conversation

@brandonmarshal

Copy link
Copy Markdown
Collaborator

Summary

Builds the Search Results template's main content: a hero with a static "Search LightSpeed" heading and a pill search field, a category-eyebrow results list bound to the real WordPress search query, and a "Useful destinations" section shown below the results regardless of result count. Previously this template had only a bare title/search field/plain query loop.

Hero

  • Added patterns/hero/search-hero.php: breadcrumb trail, eyebrow, static "Search LightSpeed" H1 (intentionally not bound to the query term), supporting copy, and a no-button pill search field (is-style-search-pill, reused from the existing Blog All Articles search box). The breadcrumb is embedded in the hero itself rather than the shared ls-theme/breadcrumbs template part, so it shares the hero's own padding instead of stacking a second set on top — same convention as blog-hero/work-hero.
  • Added src/scss/structural/search-hero.scss for the hero's decorative corner-glow background (two layered radial gradients — color.gradient block support only accepts one), reusing the existing effect.hero.brand/effect.hero.cyan tokens.

Results list

  • Rebuilt patterns/template-search.php: hero → results query loop → useful destinations. core/query keeps inherit:true (defers to the main search query, so pages and posts both appear) with the previously-unused postType/search/exclude args removed.
  • Each result shows a category eyebrow (core/post-terms), an H2 title (level:2 — the previous level:3 skipped a heading level with no H2 before it), an excerpt, and a hairline divider (border.card).
  • Whole-row is clickable with a rightward-shift hover, using the same stretched-link technique as Card - Post: a real core/read-more link hidden with font-size:0, not the core screen-reader-text utility (that sets position:absolute on the anchor itself, which breaks the stretched-link's ::before{inset:0} sizing against the row).

Useful destinations

  • Added patterns/sections/search-useful-destinations.php: eyebrow, heading, and a 4-card grid (FAQ, Pricing, Website packages, Contact), reusing the existing is-style-card-category/ls-icon-well-brand/is-style-link-arrow-accent styles and the same Phosphor icon markup already used by 404-best-next-routes.php. Kept as a separate, self-contained file per this repo's one-pattern-per-file convention. Always shown below results, matching the 404 template's "Best next routes" precedent.

Fixes found along the way

  • styles/blocks/search/search-pill.json: neither this file nor core-search.json set a color on the search input, so it fell back to the browser's black UA default — invisible against this pill's dark-mode surface.card background. Added explicit text.default/text.subtle for typed text and placeholder. Fixes both consumers of this shared style (this template's hero and Blog All Articles' header search, which had the identical latent bug).
  • Results hover title colour used link.accent (dark mode: cta-500, the same saturated cyan as the CTA buttons — too loud for hover-only state on heading-sized text). Changed to link.accent-hover (dark mode: cta-300, same family, softer), the token that exists specifically for this role.
  • Added .ls-optical-trim (text-box-trim/text-box-edge, with a transform: translateY(calc((1cap - 1lh) / 2)) fallback for broader browser support) to both heading/eyebrow pairs in the hero and destinations section. line-height alone can't fully cancel a font's own built-in leading — Manrope (body) and Lexend (display) carry different amounts of it — which was making the gap above each heading read larger than the gap below, even at identical margin values. cap/lh are real CSS units the browser resolves per-font, not a guessed offset.

Investigated, not changed

  • theme:validate's styles/light.json missing failure is confirmed pre-existing on develop, unrelated to this branch.
  • functions.php's existing PHPCS findings (tabs/comment spacing around lines 102-115) are confirmed pre-existing via git stash comparison, unrelated to this branch.

Test plan

  • php -l clean on all changed/new PHP files
  • vendor/bin/phpcs --standard=WordPress — zero findings on all changed files except the confirmed-pre-existing functions.php issue above
  • npm run patterns:escape — clean (one pre-existing false-positive wp_json_encode idiom flagged, same pattern already present elsewhere in the repo)
  • npm run security:scan — clean
  • npm run schema:validate — all JSON passes
  • npm run theme:validate — the one failure (styles/light.json missing) confirmed pre-existing on develop
  • Verified against the dev site (ls-agency.lightspeedwp.dev, this theme's active environment there): category taxonomy exists on post and matches local; page has no taxonomies on either, consistent; all four destination links (/faq/, /pricing/, /website-packages/, /contact/) are published there
  • Manual visual QA in a local Studio instance (light and dark), including hover states and heading hierarchy in the rendered DOM
  • Manual visual QA on the dev site itself after merge

Closes LS-2594

Patterns
- Add search-hero.php: eyebrow, static "Search LightSpeed" heading, description, pill search field
- Add search-useful-destinations.php: 4-card grid (FAQ, Pricing, Website packages, Contact) reusing existing card/icon styles
- Rebuild template-search.php: hero → results loop → useful destinations

Results loop
- Add category eyebrow (core/post-terms) and hairline divider per result
- Remove unused postType/search/exclude query args ignored by inherit:true
- Pages now correctly appear alongside posts in results

Notes
- No new colour tokens or font-size presets — full reuse of existing tokens/styles
- CHANGELOG.md updated under [Unreleased] — Build Search template (LS-2594)
Breadcrumbs and padding
- Embed yoast-seo/breadcrumbs directly in search-hero.php instead of the
  shared breadcrumbs template part, matching blog-hero/work-hero convention
- Removes double top padding (hero's own + the shared part's) and aligns the
  breadcrumb to the wide row instead of a narrower centered one
- Bump section top/bottom padding to spacing|90 (matches sitewide hero pattern)

Internal rhythm
- Increase blockGap between eyebrow, heading, description, and search field
  by three token steps (60→70→80, 20→30→40, 30→40→50) to match the Figma
  reference's proportions

Divider and background
- Add a real border-bottom (border.card token) between hero and results
- Add src/scss/structural/search-hero.scss: two corner radial-gradient glows
  reused from existing effect.hero.brand/effect.hero.cyan tokens (no new
  tokens), same layered-gradient technique as blog-hero.scss/work-hero.scss
- Wire the new stylesheet into package.json build scripts, functions.php
  editor styles, and inc/animations.php's is_search-conditional enqueue

Notes
- No new colour tokens or font-size presets
- templates/search.html no longer inserts the standalone breadcrumbs part
Whole-card clickable results
- Fix stretched-link on result rows: screen-reader-text sets
  position:absolute on the anchor, clipping it to 1px and breaking the
  ::before{inset:0} hit area (it sized against that 1px box instead of
  the card) — switch to font-size:0 (Card - Post's existing technique)
  so the anchor stays non-positioned and the whole row is clickable
- Add rightward-shift + title accent-color hover motion, matching the
  whole-card hover convention used by other cards in this repo

Dark mode fixes
- Hover title colour was link.accent (dark: cta-500, the same
  saturated cyan as CTA buttons) — wrong token for a hover state;
  switch to link.accent-hover (dark: cta-300, same family, softer),
  which exists specifically for this role
- search-pill.json never set an explicit input colour, so text fell
  back to the browser's black UA default — invisible on the dark pill
  surface, only working in light mode by coincidence. Add
  text.default (typed text) and text.subtle (placeholder), both
  already dark/light-paired. Checked both consumers of this shared
  style first (Search hero, Blog All Articles header search) — same
  latent bug existed in both, now fixed for both

Notes
- No new tokens, no token definitions changed — only which existing
  token each rule references
Spacing
- Equalize eyebrow→heading and heading→cards gaps to spacing|70
  (previously an incorrect flat blockGap, then a wrong asymmetric
  80/40 split that made it worse)

Font-leading fix
- Set line-height:1 on the eyebrow label and heading to remove most
  added leading
- Add .ls-optical-trim (search-hero.scss, already Search-template
  scoped): text-box-trim/text-box-edge as the forward-looking CSS fix,
  plus a transform: translateY(calc((1cap - 1lh) / 2)) fallback —
  browser-calculated from each font's own real metrics (Lexend vs
  Manrope have different built-in leading), not a guessed pixel value
- Removed an earlier calc(spacing--60 - 18px) hardcoded offset that
  only coincidentally matched one screenshot and wasn't a real fix

Notes
- No new colour tokens; spacing uses existing spacing|70 preset
- cap/lh CSS units and text-box-trim degrade gracefully in
  unsupported browsers (silently ignored, same as before this fix)
Font-leading fix
- Add ls-optical-trim (already built for Useful destinations) and
  line-height:1 to the hero's eyebrow label and "Search LightSpeed"
  heading — same Lexend/Manrope leading mismatch as the destinations
  section, same fix

Spacing
- Bump eyebrow→heading, heading→description, and description→search
  field gaps up two token steps each (80→100, 40→60, 50→70)
- Bump core/post-title from level 3 to level 2 in the results loop —
  previously skipped H2 entirely (H1 hero -> H3 results -> H2
  destinations, out of order), violating AGENTS.md's no-skipped-
  heading-levels requirement
- Verified live: H1 -> H2 (each result) -> H2 (destinations) -> H3
  (destination cards), no skips
- Consolidate all Search template work into the single existing
  entry (hero, destinations section, results list, optical-leading
  fix, search-pill contrast fix, heading hierarchy fix)
- Add dev-site verification notes (taxonomy alignment, link checks)
@brandonmarshal brandonmarshal added area:search Search/filters (incl. FacetWP) area:theme Theme & styles (templates, template parts, FSE) comp:block-patterns Patterns library/registration comp:theme-json Tokens, presets, settings comp:typography Type scale/fluids lang:css Stylesheets lang:json JSON config/content lang:php PHP code priority:normal Default priority for most issues. status:needs-review Awaiting code review labels Sep 4, 2026
@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

LS-2594

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new stretched-link focus styling likely produces an invisible focus outline for keyboard users, and the new search CSS bundle registration should be aligned with the theme’s render-marker fallback to avoid missing styles when patterns/classes are reused outside search contexts.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Builds out the Search Results template’s main content by replacing the minimal title/search/query-loop layout with a dedicated hero, an improved results list presentation, and a reusable “Useful destinations” section, while ensuring the supporting structural CSS is compiled and enqueued.

Changes:

  • Reworked the Search template to use a new hero pattern plus a rebuilt results loop and destinations section.
  • Added structural styling for the search hero background and for clickable/hoverable result rows.
  • Updated the shared search-pill block style to explicitly set input and placeholder text colours for correct contrast.
File summaries
File Description
templates/search.html Removes the standalone breadcrumbs template part in favour of hero-owned breadcrumbs.
styles/blocks/search/search-pill.json Sets input/placeholder text colours for contrast and documents the rationale.
src/scss/structural/search-results.scss Adds stretched-link + hover/focus styles for search result rows.
src/scss/structural/search-hero.scss Introduces search hero layered gradient background and .ls-optical-trim.
patterns/template-search.php Rebuilds main search template pattern: hero → results loop → useful destinations.
patterns/sections/search-useful-destinations.php Adds the “Useful destinations” section pattern used after results.
patterns/hero/search-hero.php Adds the Search hero pattern with breadcrumb, heading, and search-pill field.
package.json Ensures search-hero.scss compiles in build/watch Sass scripts.
inc/animations.php Registers search-hero CSS bundle for front/editor under is_search.
functions.php Adds assets/css/search-hero.css to editor styles.
CHANGELOG.md Documents the new Search template work under Unreleased.
assets/css/search-results.css Compiled output for updated search results structural styles.
assets/css/search-hero.css Compiled output for the search hero background + .ls-optical-trim.
Review details

Files not reviewed (2)

  • assets/css/search-hero.css: Generated file
  • assets/css/search-results.css: Generated file
  • Files reviewed: 11/13 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread inc/animations.php
Comment thread src/scss/structural/search-results.scss Outdated
Comment thread src/scss/structural/search-hero.scss
Comment thread patterns/sections/search-useful-destinations.php
- Add render-marker fallback entries for search-hero/search-results
  bundles (ls-search-hero, ls-optical-trim, ls-search-result) so their
  CSS still loads if those patterns/classes are ever reused outside
  a search page — previously they had no fallback at all, unlike
  every other insertable pattern's bundle
- Add is_search() to work-archive-sections' head-time condition —
  Useful destinations reuses its is-style-card-category/
  ls-icon-well-brand classes, which were only being caught by the
  render_block footer fallback, causing a visible flash of unstyled
  cards after first paint
- Move the search-result stretched-link's focus outline from
  .ls-search-result__link to its ::before overlay — the link itself
  is font-size:0 (collapsed by design), so the outline was rendering
  invisible for keyboard users
- Gate the optical-leading transform behind
  @supports not (text-box-trim: trim-both) — in browsers that
  support text-box-trim, the native trim and the transform fallback
  were both applying, over-shifting the text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:search Search/filters (incl. FacetWP) area:theme Theme & styles (templates, template parts, FSE) comp:block-patterns Patterns library/registration comp:theme-json Tokens, presets, settings comp:typography Type scale/fluids lang:css Stylesheets lang:json JSON config/content lang:php PHP code priority:normal Default priority for most issues. status:needs-review Awaiting code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants