Skip to content

Shrink the search trigger on small screens - #58

Merged
rubensworks merged 1 commit into
masterfrom
claude/mobile-search-trigger
Sep 13, 2026
Merged

rubensworks merged 1 commit into
masterfrom
claude/mobile-search-trigger

Conversation

@rubensworks

Copy link
Copy Markdown
Member

On a phone the search trigger took 164px of a 390px header, which squeezed the book title into three lines. It now shows its icon alone.

At 390px Before After
Trigger width 164px, 42% of the screen 30px
Space left for the title 90px 240px
Title lines 3 2
Header height 116px 78px

Measured on both books, so it is not specific to the longer Integrated Dynamics title: EvilCraft was also wrapping to three lines.

Why the existing rules did nothing

The rules that hide the label and the shortcut badge were already in the stylesheet from the search change. They never applied.

The Pagefind components deliberately give their own rules ID-level specificity, using chained :is(*, #\#) selectors, so that host pages cannot accidentally break them. Nothing built from element and class selectors can outrank that, and there is no custom property for the trigger's contents. So the override has to be forced, and it is scoped to the phone layout only.

Removed rules that could not work

The same specificity explains something I had not noticed: the rules meant to paint the trigger over the dark cover never took effect either. I checked each declaration against its computed value:

Declaration Intended Actual
background rgba(255,255,255,.06) rgb(230,214,172)
color #fff the muted ink
padding 6px 10px 0 14px
border-color rgba(255,255,255,.35) the book border
--pf-icon-search white icon unused, the icon is not a background image

They are deleted rather than left looking meaningful. Nothing changes visually, because they were never in effect: the trigger is themed through the custom properties, like the dialog, and reads as a small parchment search field on the cover. The comment above that block claimed the trigger was reachable by ordinary selectors, which was wrong, so it is corrected too.

Net effect on the stylesheet is 38 lines removed, 8 added.

Verified

  • Trigger width, title lines and header height measured at 390, 360, 640 and 1280 pixels. Nothing above 640 changes: the trigger is still 164px wide with its label and shortcut on desktop.
  • Search still opens and returns results at both phone and desktop widths, with no console errors.
  • npm run build, npm run lint and npm test pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FuDB4UAnaLnNEEv8kVuotH


Generated by Claude Code

On a phone the trigger took 164px of a 390px header, which squeezed the book
title into three lines. It now shows its icon alone, 30px wide, and the title
fits in two.

The rules that hid the label were already there but never applied: the Pagefind
components give their own rules ID-level specificity, so no selector of ours can
outrank them, and there is no property for this. Hence the forced override,
scoped to the phone layout.

The same specificity is why the rules that painted the trigger over the cover
never took effect either. They are removed rather than left to look meaningful:
the trigger is themed through the custom properties, like the dialog, and reads
as a small parchment search field.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuDB4UAnaLnNEEv8kVuotH
@rubensworks
rubensworks merged commit c4b0182 into master Sep 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants