doxa-maps/library/components/search
Doxa Maps c683d49716 The dashboard now says out loud what a filter just did
Cross-filtering is the one interaction whose whole point is that acting on ONE
control changes a number somewhere ELSE. Pick "Islam" in the left rail and 2,107
becomes 693 across the KPI strip, the map, the table and the charts. A sighted
user watches that happen. A screen-reader user heard nothing at all: this
element carried exactly one role="status" (the table's selection pill) and zero
aria-live regions. The filter worked; the feedback did not exist.

ONE polite live region in the shell, not one per panel. Six surfaces change on
every brush, and polite announcements QUEUE — six regions would make the user
wait through five repeats before reaching the next control. It is always
rendered and starts empty, because a live region inserted already holding its
text is routinely not announced; it is visually hidden rather than display:none,
which would take it out of the accessibility tree along with the pixels. It is
debounced at 700ms for the same reason the selection camera is debounced: typing
re-derives the row set per keystroke, and an un-debounced region would queue one
announcement per character. It stays silent on arrival and only ever reports a
change. It names the count, the total, the active facets and the search term,
formatted by the shell's own formatter so it can never read as a different
number from the KPI strip beside it.

ONE RESIZE HANDLE ANNOUNCED ITSELF IN ENGLISH in all 11 locales. Four of the five
read their title and aria-label through T(); the map/table one held raw string
literals. It survived review because each half looks correct on its own — the
ternary is right, the strings are right, only the missing T( is wrong. Both now
resolve through the catalogue. (The keys themselves are on
sr/dashboard-a11y-strings: aria.json held eleven keys and not one was a resize
key, so ALL five handles have been falling back to English. The T() call sites
were right the whole time.)

THE CHIP ✕ IS NOW BIG ENOUGH TO HIT. The live strip's remove button was a
~13x16px glyph — the smallest control in the product, and the only way out of a
narrowed board, where a miss costs the reader the whole view. The row height
cannot grow: three comment blocks above it record a measured layout-shift bug and
the Driver's "a lot more subtle" instruction that pinned it to 16px. So the HIT
AREA grows and the BOX does not, via an absolutely-positioned 24x24 ::after that
contributes nothing to the flex row's intrinsic size. Nothing moves by a pixel.
2.5.8 is a TARGET SIZE criterion, not a touch one, so it is unconditional. A
focus-visible ring too, since the chips live in an overflow-x strip where being
scrolled into view is not the same as being visible.

The kit's own DashboardFilterChips were spans with click delegation — not
focusable, no click from Enter or Space. They are buttons now, with an aria-label
naming the ACTION rather than the filter ("Religion: Islam" is a good name and a
useless action), type="button" so a partner's form is not submitted by a chip, a
focus ring and a 24px floor. The reset-all chip deliberately gets NO aria-label:
its visible words already are the action, and overriding them breaks voice
control.

Recording what this does NOT fix, because the measurement that prompted it named
the wrong file. DashboardFilterChips is exported from the kit and mounted by
NOBODY — round 1 of BUG-DUPLICATE-FILTER-BADGES removed it, and the strip on
screen belongs to SearchFilterHeader, whose remove button was already a real
<button type="button"> with a localized aria-label. So the keyboard half was a
latent defect closed before the next dashboard mounts it, not a live one. The
live defect in that same control was its size, above.

check:dashboard-filter-a11y guards all of it, on the kit component AND the strip
that actually ships. It walks the parsed template AST rather than grepping,
because grep cannot tell a bound :aria-label from a literal one, cannot tell a
button from a span named like one, and cannot see a live region hiding inside a
v-show'd cell. It also reads the built bundle, since source-correct plus
bundle-stale is a real repeat failure here. Fourteen mutants were run against it;
every one fails, naming the file and the reason. No browser — that is rega's.

STUDIO: needs a rebuild of research-dashboard and dashboard-plus-grid (the
composite bakes the shell in). Part D of the gate fails until you do, by design.
2026-09-26 13:35:57 +00:00
..
FilterDropdown.vue FilterDropdown: translate when the host has i18n, never require it 2026-09-25 03:19:23 +00:00
fuzzy.js Search tier 2: a misspelled country resolves to THE country (best match, 2-edit cap) 2026-09-24 00:34:19 +00:00
README.md Search is FUZZY again, Fuse-parity: typo tolerance restored on every surface 2026-09-23 23:08:48 +00:00
SearchBar.vue Restore cap-4 i18n context (configureApp) and re-theme shared search components to the DX palette 2026-09-20 05:15:02 +00:00
SearchFilterHeader.vue The dashboard now says out loud what a filter just did 2026-09-26 13:35:57 +00:00

@map/components/search — shared search + filter primitives

ONE source of truth for the search-bar, the searchable filter-dropdown, and the fuzzy matcher. Consumed by BOTH plugins so there is no duplication:

  • cap-2 plugin-designs/people-groups-grid/ — its own header (default) drives the grid.
  • cap-1 plugin-designs/big-picture/ — the Unified Research Dashboard header (BpResearchHeader.vue) can adopt these to replace its hand-rolled <input> + native <select>s (card BUILD-G1-CAT4-BIG-PICTURE-DASHBOARD wires them in).

All three are props-driven, emit-based, framework-agnostic — no Nuxt context, no i18n composables, no plugin-specific hardcoding. Styles are inlined + scoped so each self-styles inside a standalone custom-element shadow root.

Import via the @map alias (resolves to library/):

import SearchBar          from '@map/components/search/SearchBar.vue'
import FilterDropdown     from '@map/components/search/FilterDropdown.vue'
import SearchFilterHeader from '@map/components/search/SearchFilterHeader.vue'
import Fuse               from '@map/components/search/fuzzy.js'
  • research-dashboard plugin-designs/research-dashboard/ — bakes SearchFilterHeader in as header-1 (search) + header-2 (dropdowns) via the thin adapter src/components/dashboards/DashboardResearchFilters.vue (couples it to the selection bus).

SearchBar.vue

A magnifier-icon + <input type="search">.

Prop Type Default Purpose
modelValue String '' Bound value; supports v-model.
placeholder String 'Search…' Input placeholder text.
ariaLabel String 'Search' Accessible label.
maxWidth String '' Optional CSS max-width (e.g. '480px'); empty = fill container.
Event Payload When
update:modelValue String On every input (enables v-model).
search { value } On every input; value is the raw string (read in-control, so shadow-DOM retargeting never loses it).
<SearchBar :model-value="term" placeholder="Search people groups…" max-width="480px" @search="onSearch" />
<!-- onSearch(payload) { term = payload.value } -->

FilterDropdown.vue

A searchable single-select with per-option counts (the four axes: Region / Block / People-Group / Religion in the grid; Region / Status in the dashboard).

Prop Type Required Default Purpose
label String yes — Control label, e.g. "Region".
name String yes — Axis/field key echoed back in events.
options Array no [] [{ value, label, count?, type? }].
value String no '' Currently-selected value (controlled).
placeholder String no 'Type to search...' In-menu search placeholder.
Event Payload When
filter-change { name, value, label, type } An option was picked.
filter-clear { name } Selection was cleared.
<FilterDropdown label="Region" name="wagf_region" :options="opts" :value="sel"
  @filter-change="onFilterChange" @filter-clear="onFilterClear" />

SearchFilterHeader.vue

The DX-life research-page filter header, cloned as ONE parameterized element: header-1 (a SearchBar) + header-2 (an "expand filters" row of FilterDropdowns + optional boolean toggle-pills + a removable active-chip strip). Pure UI/interaction — no bus, no fetch — so the consumer supplies option lists + selected values and reacts to the emits. The dropdown row is a SINGLE row that never wraps — it horizontal-scrolls on overflow (card BUILD-DROPDOWNS-HORIZONTAL-SCROLL-ONE-ROW).

Prop Type Default Purpose
search String '' Search-bar value (supports v-model:search).
filters Array [] Dropdown axes: [{ name, label, options, value?, placeholder? }].
toggles Array [] Boolean pills: [{ name, label, active? }].
activeChips Array | null null Removable chips [{ name, label }]; omit to auto-derive.
searchPlaceholder String 'Search…' header-1 placeholder.
searchMaxWidth String '520px' header-1 search box max-width.
showFilters Bool | String true Render the header-2 filter row at all.
startExpanded Boolean false Show the dropdown row without a first click.
collapsible Boolean true Show the Show/Hide-Filters toggle; false = always open.
labels Object {} i18n overrides (show/hide_filters, clear_all, type_to_search…).
Event Payload When
update:search String Search changed (v-model).
search { value } Every keystroke.
filter-change { name, value, label, type } A dropdown option was picked.
filter-clear { name } A dropdown selection cleared.
toggle { name, active } A toggle-pill flipped.
remove-filter { name } An active chip's ✕ clicked.
clear-all — "Clear all" clicked.
<SearchFilterHeader
  v-model:search="term" :filters="filters" :active-chips="chips" start-expanded
  @search="onSearch" @filter-change="onPick" @filter-clear="onClear"
  @remove-filter="onRemove" @clear-all="onClearAll" />

fuzzy.js

A zero-dependency Fuse.js-shaped matcher (so no npm dep is added to the shared package.json/bun.lock).

const fuse = new Fuse(list, {
  keys: ['name', 'country_code.label', 'religion.label'], // dotted paths
  threshold: 0,          // 0 = exact substring only; >0 = fuzzy (k-errors edit distance, Fuse-parity)
  minMatchCharLength: 3, // shortest run counted as a match
})
fuse.search(term) // -> [{ item, matches: [{ key, indices: [[start,end], …] }] }]
  • Empty term → every item with matches: [].
  • matches[].indices drive <span class="search-highlight"> wrapping (same shape as Fuse's includeMatches).

Verification (headless)

  • fuzzy.js: exact + fuzzy + empty-term contracts asserted via a node harness.
  • SearchBar / FilterDropdown: SSR-mounted (@vue/server-renderer) — render icon + input, trigger + label, and reflect a selected value.
  • bun run build builds the people-groups-grid bundle green consuming these shared imports (all guards pass).