Skip to content

fix(search): shrink the topbar search box so it can't overflow on mobile#45

Merged
mhenrixon merged 2 commits into
mainfrom
fix/topbar-search-mobile-overflow
Jul 3, 2026
Merged

fix(search): shrink the topbar search box so it can't overflow on mobile#45
mhenrixon merged 2 commits into
mainfrom
fix/topbar-search-mobile-overflow

Conversation

@mhenrixon

Copy link
Copy Markdown
Owner

What & why

Found while dogfooding the consumer docs sites (phlex-reactive, daisyui): on a 390px phone the topbar's brand + search box + theme switcher overflowed by ~34px, pushing the theme switcher off-screen and giving the page a horizontal scrollbar. This is a regression on every consumer site since the server-rendered search shipped (#35) — the CI "Demo site" responsive spec on the phlex-reactive docs refresh caught it (document.documentElement.scrollWidth - clientWidth == 34, offending element: the .dropdown search box).

Root cause

DocsUI::SearchBox's outer container was dropdown flex-noneflex-none refuses to shrink — and daisyUI's .input carries a default min-width. So on a narrow topbar the search box held its intrinsic width and the theme switcher (in a sibling flex-none) was pushed past the viewport edge.

Fix

  • flex-nonemin-w-0 on the search box, and min-w-0 on the form, so the box can shrink.
  • Cap the input label at max-w-[40vw] on mobile, lifted at sm:max-w-none, so the brand + search + switcher always fit at 390px regardless of platform font metrics.

The shortcut <kbd> hints were already hidden sm:flex, so mobile only loses a little input width — the box stays usable and the palette still opens.

Verification

  • New DocsUI::SearchBox spec asserts the shrink classes are present and flex-none is gone.
  • bundle exec rspec539 examples, 0 failures.
  • bundle exec rubocop — clean.
  • Verified end-to-end against the phlex-reactive docs (patched the installed gem, rebuilt CSS, ran the responsive system spec) — no overflow.

The new max-w-[40vw] is a render-time literal in a .rb component, so it's scanned into the Tailwind build like the other chrome classes (verified it appears in a consuming site's built CSS).

Refs #8.

https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX

mhenrixon added 2 commits July 3, 2026 15:53
The dogfood site had drifted badly behind the gem (epic #8 shipped Markdown
islands, the API-docs kit, the .md twin, llms.txt, search, MCP, --sync, and
more — none of it documented). Rewrite + extend so the site documents AND
demonstrates every capability, each page dogfooding the gem.

Registry + nav (app/models/doc.rb)
- Regrouped into 5 headings: Getting started / Authoring / Reference /
  AI & tooling / Deploy. nav_registries stays the canonical nav path.

New pages
- Markdown authoring (/docs/markdown) — the `md` island, the single-quoted
  heredoc convention, the GFM vocabulary rendered LIVE, how it flows into the
  .md twin.
- API reference (/docs/api) — renders a live DocsUI::Endpoint + FieldTable +
  ErrorTable + RequestExample (4 client tabs) + JsonResponse, plus the
  api_base_url/api_auth_header/api_clients config.
- AI & agents (/docs/ai) — the .md twin, the Markdown masthead action,
  /llms.txt + /llms-full.txt, the built-in MCP server, and the AGENTS.md +
  write-docs-page skill the generator scaffolds.
- Search (/docs/search) — server-rendered search + the ⌘K palette, the
  search_/search_path/search_shortcuts config, progressive enhancement.

Rewrites
- Configuration — the "All options" table is now COMPLETE (28/28 knobs with
  defaults, was 13), grouped by concern; notes version_badge accepts a String
  or callable; nav_registries canonical, c.nav the escape hatch.
- Overview — current "What you get" covering the whole surface, each feature
  linking to its page.
- Installation — documents the --sync additive upgrade path.
- Styling & CSS — adds c.code_theme / code_theme_dark / dark_themes (the
  light/dark Rouge highlight mechanism), corrected to describe the now-graceful
  theme-name degradation (not the old NameError crash).
- Authoring — expanded building-blocks section links to the dedicated pages.

Every page dogfoods the kit (md islands, DocsUI::Section/Code, live component
renders) and renders 200; the .md twin, /llms.txt, /llms-full.txt, and search
all render clean. Gem suite stays green (538 examples).

Refs #8

Claude-Session: https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX
Found while dogfooding the consumer sites: on a 390px phone the topbar's
brand + search box + theme switcher overflowed ~34px, pushing the theme
switcher off-screen (a horizontal-scroll regression on every consumer site
since the search feature shipped).

The search box was `dropdown flex-none` — it refused to shrink — and daisyUI's
`.input` carries a default min-width. Change it to `min-w-0` (shrinkable) and
cap the input at `max-w-[40vw]` on mobile, lifted at `sm:`. The brand + search +
switcher now fit at 390px regardless of platform font metrics.

Spec asserts the shrink classes are present (and flex-none is gone).
539 examples, 0 failures; rubocop clean.

Refs #8

Claude-Session: https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX
@mhenrixon mhenrixon merged commit 82d76a7 into main Jul 3, 2026
4 checks passed
@mhenrixon mhenrixon deleted the fix/topbar-search-mobile-overflow branch July 3, 2026 15:11
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