jb-website/docs/superpowers/follow-ups/2026-06-02-blog-search-featured-match.md
Josh Bairstow be9b0ac994 chore(blog-search): add astro/check dep, plan, and follow-up note
- @astrojs/check + typescript bump are needed to run `npx astro check`,
  which is the type-verification command used throughout this branch.
- docs/superpowers/plans/ pairs with the existing spec under specs/.
- docs/superpowers/follow-ups/ records the featured-match behaviour
  change surfaced during manual test; addresses in a later branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 01:54:46 +10:00

34 lines
2.4 KiB
Markdown

# Follow-up: featured article should respect search match
**Date filed:** 2026-06-02
**Source:** Manual test of `feat/blog-search` before merge
**Relates to:** `docs/superpowers/specs/2026-06-01-blog-search-design.md` (§ "What should happen to the featured article when a query is active?")
## What's wrong
When a query is typed into the blog search input, the featured article currently hides regardless of whether its content matches the query. In manual testing this felt wrong — if the featured article matches the search term, it should remain visible like any other matching row.
## What the original design said
During brainstorming, three options were presented for featured-article behavior under filtering. The user chose "Hide while filtering" with the reasoning "simpler mental model: query active = filter mode." After actually using the feature, the user now wants option 2 from that brainstorm: **treat the featured article as a filterable row** — visible iff it matches the query.
## What needs to change
In `src/components/molecules/BlogSearch.astro`, the `applyFilter` function has this branch:
```ts
} else if (isFeatured) {
// Featured hides whenever there's a query, regardless of match.
visible = false;
}
```
Replace it so the featured row goes through the same `tokens.every(t => haystack.includes(t))` check as every other row. Drop the `isFeatured` special case entirely — it can fall through to the general match branch.
Then sanity-check the empty-state count: `visibleCount` currently skips the featured (`if (visible && !isFeatured) visibleCount += 1`). Once featured participates in the filter, it should count toward the visible total — otherwise a query that *only* matches the featured will trigger the "no entries match" message even though featured is showing. Drop the `!isFeatured` guard there too.
Visually the featured block is much bigger than a row, so when it's the sole match the layout will look unusual but not broken. If that turns out to feel wrong in practice, the second-order fix would be to render the featured-as-result in the same compact PostRow style as the archive. Don't pre-emptively build that — wait until the simple behavior change is in and see if it's actually needed.
## Update the spec when you fix this
Update `docs/superpowers/specs/2026-06-01-blog-search-design.md`'s relevant section so the spec reflects the new behavior. The current text claims "Featured hides while filtering" — that line is now wrong.