Repository navigation
fix(quant_search): theme-neutral default styles for the search page and search box - #269
Merged
Merged
Conversation
…nd search box The default CSS fought the site theme: theme form styles drew a second input inside the search box with suggestions, a heading in each suggestion spread the list apart, the search page input shrank to its intrinsic width while its clear button stayed at the far edge, the InstantSearch theme's fixed colours and the hit card margins ignored the theme, and the filter checkboxes had no gap to their labels or counts. - quant_search.algolia.css: rewritten. Inherits fonts and colours, overrides the InstantSearch theme's fixed colours, full-width search box with 44 px submit and clear targets, filter rows with a gap, counts at the row end, visible focus outlines, neutral pagination and clear-filters buttons. Theming via --quant-search-* custom properties (listed in the file header). Hides empty filter groups and single-page pagination. - quant_search.autocomplete.css: stops theme input styles inside the box, draws the focus outline on the form, readable placeholder, tidy suggestion rows. - quant-autocomplete.js: suggestions use a span, not an h6 (a listbox option must not hold a heading). A theme can set the panel placement with --quant-search-autocomplete-panel-placement. - search-page.html.twig: the search box spans the full width above the filters and results; the filters are a details element that folds away on narrow screens; each filter group is a labelled group; the result count is a status region. - quant-search.js: opens or folds the filters by screen width; "Clear filters" instead of "Clear refinements".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The quant_search default CSS and markup fought the site theme. On Olivero (and Olivero subthemes) the search page and the search box with suggestions looked broken. This makes the defaults neutral: they inherit the theme's fonts, colours and links, and a theme adjusts them through custom properties.
Search box with suggestions (autocomplete block):
[type="search"]) drew a second bordered input inside the Algolia form, with its own heavy focus ring.quant_search.autocomplete.cssnow resets the inner input and draws one focus outline on the form.<h6>. Theme heading margins spread the list over ~100 px per row, and a listbox option must not contain a heading. It is now a<span class="autocomplete-hit-name">.--quant-search-autocomplete-panel-placement(start, end, full-width, input-wrapper-width) lets a theme show suggestions wider than a narrow header box. Default unchanged.Search page:
width: auto) while the clear button stayed at the far edge of the form. The input now fills the form; submit and clear are 44 px targets inside it; the spinner and clear button respect thehiddenattribute.role="group"per facet, empty groups hidden. On narrow screens the filters fold behind a "Filter results" toggle (<details>), opened by default on wide screens.#5878f9link colour (3.9:1, fails AA) and#e7eefahighlight; neutral dividers instead.#0096dbwhite-text buttons (3.3:1) are gone. Pagination hides when there is one page.role="status"region..quant-search button { background: transparent; border: none }, which stripped every button inside the page, and the 600 pxmargin: 1emthat broke theme gutters.Theming hooks (documented in the CSS file header):
--quant-search-gap,-facets-width,-facet-gap,-border-color,-divider-color,-radius,-input-height,-input-background,-focus-color,-tint,-checkbox-size,-accent. The autocomplete keeps the Algolia--aa-*properties.Checks
phpcs --standard=Drupal(CI's extensions) onmodules/quant_search: clean.node --checkon both scripts.Open points
.col.content, and.col.facetsis now a<details>. Themes that overridesearch-page.html.twigkeep their copy and are not affected. Theme CSS that targets.col.content .ais-SearchBoxwould need an update.header. In Olivero that region is the logo row: an unstyled box there pushes the navigation into the mobile menu at every width. A better default for Olivero-based themes (or a note in the form) is worth a separate change. PR fix(quant_search): remove a deleted search page's search box, and repair one left behind #268 also editsCreateSearchPageForm.php, so I left it alone here.:has()(hide empty filter groups) andcolor-mix()(neutral tints). Both are in all current evergreen browsers; older browsers show empty groups and fall back to no tint.h4for hit titles and the empty message) are unchanged.2.x(the 2.3.0 line all recent quant_search PRs target); the GitHub default branch8.x-1.xdoes not have this code.