Skip to content

Let the mobile search dialog fill the screen, and put Cancel by the field - #272

Merged
fstubner merged 2 commits into
mainfrom
fix/mobile-search-layout
Aug 28, 2026
Merged

fstubner merged 2 commits into
mainfrom
fix/mobile-search-layout

Conversation

@fstubner

Copy link
Copy Markdown
Owner

The mobile search item: the clear control in the wrong place, Cancel beside the results, and the results not reaching the bottom of the screen. All three measured at 500×708 with results on screen.

The results stopped 151px short

Two fixed reservations, both for chrome that does not exist at this size:

#starlight__search       max-height: calc(100vh - 9.5rem)   → 152px reserved
.pagefind-ui__drawer     max-height: calc(100vh - 15rem)    → 240px reserved

The dialog is inset 9px and runs nearly full height; the drawer's bottom landed at 557 in a 708 viewport.

Swapping those for 100% was not the fix — no ancestor has a definite height for a percentage to resolve against, so the drawer took its content height and pushed 1253px past the viewport, scrolling the page instead of itself.

The chain was the actual problem. #starlight__search was already a flex column, but the drawer is two levels below it:

#starlight__search      flex column, h=646
  .pagefind-ui          display:block, min-height:auto, h=1936   ← will not shrink
    .pagefind-ui__form  display:block, flex 0 0 auto,   h=1936   ← nor this
      .drawer           h=1872

Both middles are flex columns with min-height: 0 now, and the form moved from flex: 0 0 auto — correct when it held only the input — to 1 1 auto, since it holds the drawer too.

After: drawer 89→671, 37px of frame below it, scrolling inside itself.

Cancel sat level with the middle of the results

Starlight lays the frame out as "search close" / "drawer drawer" and files 23, 24 and 28 each pinned the button to row 1 with align-self: center. That row holds the whole Pagefind UI, not just the input, so it is ~590px tall — centring put Cancel at y=287, halfway down the results list.

start in all three. Now 43→87, beside the input at 25→73.

The clear control floated 83px short of the field's edge

Pinned to the trailing edge, 8px in.

About align-content: start

That declaration on the frame is what stopped the rows growing at all. It had been added with no stated reason. The empty-state height it appeared to be guarding is set directly by the min-height rules in 06, 23 and 28 — and I checked both states after changing it:

state drawer
no query 0×0, hidden — dialog is just the field
no matches 89→452, sized to its message, no scroll
results 89→671, fills and scrolls internally

It stays compact when it has little to show.

Desktop unaffected

Two of these changes are not width-scoped, so I measured 1440×900: drawer 145→677 in a 748 viewport, scrolling internally — same behaviour as before.

One thing I did not fix

Cancel's box sits 18px lower than centring it against the input would put it. Its own margins compute to 0 and align-self computes to start, so the offset comes from somewhere I did not chase down. It is beside the field rather than beside the results, which was the reported fault.

Verification

astro check 0 errors · a11y 0 violations in both themes · CSS shadowing budget 42 → 25 (the edits added one, a prune removed 18) · all three fixes re-measured after the prune.

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Site preview: https://pr-272.netscli-site-preview.pages.dev

Built from 495fcba with NETSCLI_PREVIEW=1 — noindex, and analytics disabled so it does not report into netscli.com's numbers.

Production is unaffected: netscli.com is served from GitHub Pages via pages.yml, which is manual-only.

…ield

Three faults, all measured at 500x708 with results on screen.

The results stopped 151px above the bottom. `#starlight__search` carried
`max-height: calc(100vh - 9.5rem)` and the drawer
`max-height: calc(100vh - 15rem)` -- 152px and 240px reserved for chrome that
does not exist at this size, where the dialog is inset 9px and runs nearly
the full height. The drawer's bottom landed at 557 in a 708 viewport.

Replacing those with `100%` was not the fix: no ancestor has a definite
height for a percentage to resolve against, so the drawer took its content
height and pushed 1253px past the viewport, scrolling the page instead of
itself. The chain is what mattered. `#starlight__search` was already a flex
column, but the drawer is two levels below it -- `.pagefind-ui` and
`.pagefind-ui__form` sit between, both `display: block` with `min-height:
auto`, so neither would shrink below its content. Both are flex columns with
`min-height: 0` now, and the form grew from `flex: 0 0 auto` (right when it
held only the input) to `1 1 auto`. Drawer bottom 671, 37px of frame below
it, scrolling inside itself.

Cancel sat level with the middle of the results. Starlight lays the frame out
as `"search close" / "drawer drawer"` and 23, 24 and 28 each pinned the
button to row 1 with `align-self: center`. That row holds the whole Pagefind
UI, not just the input, so it is ~590px tall and centring put Cancel at
y=287. `start` in all three.

The clear control floated 83px short of the field's trailing edge. Pinned to
it, 8px in.

`align-content: start` on the frame is what stopped the rows growing at all.
It had no stated reason; the empty-state height it appeared to guard is set
directly by the `min-height` rules in 06, 23 and 28, and both the empty and
no-match states were checked after changing it -- the drawer stays compact
when it has little to show and fills only when it has results.

Desktop is unaffected: 1440x900 gives drawer 145-677 in a 748 viewport,
scrolling internally, as before.

One thing not fixed: Cancel's box is 18px lower than centring it against the
input would put it. Its own margins are 0 and `align-self` computes to
`start`, so the offset is coming from somewhere I did not chase. It is beside
the field rather than beside the results, which was the fault.

CSS shadowing budget 42 -> 25. astro check 0 errors, a11y 0 violations.
Both this branch and #268 ran the CSS prune, so they disagreed on blank
lines in two files and on the shadowing budget. The whitespace hunks take
main's shape; the budget is a measurement, so it is re-counted here rather
than picked from either side.

All three search fixes re-measured on the rebased build -- cancel level with
the input, clear 8px inside the field's trailing edge, drawer ending 37px
above the viewport and scrolling internally -- and #268's rail alignment
still holds at 42.66px on both sides.
@fstubner
fstubner force-pushed the fix/mobile-search-layout branch from c38d635 to 2d1258c Compare August 28, 2026 19:03
@fstubner
fstubner merged commit cee483e into main Aug 28, 2026
14 checks passed
@fstubner
fstubner deleted the fix/mobile-search-layout branch August 28, 2026 19:07
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.

1 participant