Problem
ol-search-bar is a 950-line component with a showFacets prop that selects between two fundamentally different UIs:
- Embedded mode (
showFacets=false): compact input row with chip bar, used inline on the search results page
- Droppable mode (
showFacets=true): trigger button + viewport-fixed overlay panel, used inside ol-header
About half the code, CSS, and state only runs in one mode. CSS specificity fights (e.g. :host(.mobile-exp) overriding media blocks) exist because styles written for one mode bleed into the other. Every refactor requires mentally tracking which branch you're in.
Proposed split
| New component |
Role |
Replaces |
ol-search-bar |
Embedded input + chip bar only |
current !showFacets branch |
ol-header-search |
Trigger + overlay panel + mobile full-screen |
current showFacets branch |
ol-header would import ol-header-search. The embedded ol-search-bar stays where it is.
Migration plan
- Identify all props, state, and methods that are mode-specific vs. shared
- Extract shared logic (autocomplete fetch, filter helpers) — already partially done via
utils/facets.js
- Create
ol-header-search.js with just the droppable-mode render path, CSS, and state
- Update
ol-header.js to use ol-header-search
- Strip the
showFacets branch and dead CSS from ol-search-bar.js
- Update all tests to target the correct component
Tests needed
- Unit:
ol-header-search panel positioning contract (currently in ol-search-bar.panel-overlay.test.js)
- Unit:
ol-header-search mobile overlay contract (currently in ol-search-bar.mobile-overlay.test.js)
- Playwright: existing
mobile-overlay.spec.js and facet-and-submit.spec.js target ol-header > ol-header-search instead of ol-header > ol-search-bar
Risk
Medium. The render logic is well-tested, but consumers outside this repo may import ol-search-bar expecting droppable mode. Check for external usage before removing the showFacets branch.
Problem
ol-search-baris a 950-line component with ashowFacetsprop that selects between two fundamentally different UIs:showFacets=false): compact input row with chip bar, used inline on the search results pageshowFacets=true): trigger button + viewport-fixed overlay panel, used insideol-headerAbout half the code, CSS, and state only runs in one mode. CSS specificity fights (e.g.
:host(.mobile-exp)overriding media blocks) exist because styles written for one mode bleed into the other. Every refactor requires mentally tracking which branch you're in.Proposed split
ol-search-bar!showFacetsbranchol-header-searchshowFacetsbranchol-headerwould importol-header-search. The embeddedol-search-barstays where it is.Migration plan
utils/facets.jsol-header-search.jswith just the droppable-mode render path, CSS, and stateol-header.jsto useol-header-searchshowFacetsbranch and dead CSS fromol-search-bar.jsTests needed
ol-header-searchpanel positioning contract (currently inol-search-bar.panel-overlay.test.js)ol-header-searchmobile overlay contract (currently inol-search-bar.mobile-overlay.test.js)mobile-overlay.spec.jsandfacet-and-submit.spec.jstargetol-header > ol-header-searchinstead ofol-header > ol-search-barRisk
Medium. The render logic is well-tested, but consumers outside this repo may import
ol-search-barexpecting droppable mode. Check for external usage before removing theshowFacetsbranch.