diff --git a/docs/filter-contract.md b/docs/filter-contract.md index ec26f06e2b..cfcf20d012 100644 --- a/docs/filter-contract.md +++ b/docs/filter-contract.md @@ -118,16 +118,30 @@ corpus of that size, and it stays. Facet groups only. Density scales with option and group volume across three tiers: -| Options / Groups | Renderer | -| --------------------------- | -------------------------------------------------------------------------------------- | -| ≤ 5 options | chips, single row / wrapping chips | -| 6–20 options | dense full-width vertical list with right-aligned count column and group headings | -| > 3 groups, or > 20 options | list/chips plus find-a-filter and collapse-by-default, every group behind a disclosure | +| Options / Groups | Renderer | +| ------------------------------- | -------------------------------------------------------------------------------------- | +| ≤ 5 options, no counts | chips, single row / wrapping chips | +| 2–5 options **carrying counts** | the row renderer below, in a two-column grid | +| 6–20 options | dense full-width vertical list with right-aligned count column and group headings | +| > 3 groups, or > 20 options | list/chips plus find-a-filter and collapse-by-default, every group behind a disclosure | `ResultFilterSheet` computes the threshold across facet groups. Facet groups containing 6–20 options render as compact full-width rows with a right-aligned count column for fast scanning. When a sheet exceeds 3 groups or 20 total options, it additionally adds find-a-filter and collapse-by-default chrome. +**A counted chip is not a chip.** A two-to-five-option group whose options carry counts uses the same +row renderer as the 6–20 tier, laid out in two columns. A chip carrying a count is wide enough that +four of them wrap one per line and leave most of each row empty — documents' Source status (4) and +Clinical validation (3) were exactly that, a ragged single column down a phone sheet. Two columns +halve the height and align the counts. A group with no counts keeps the wrapping chip row, which is +still the right renderer for short bare labels. + +**`hint` is announced, `hintLabel` is displayed.** `hint` carries the unit (`"1 loaded source"`) and +is what the option's accessible name is built from; `hintLabel` is the short visible form (`"1"`). +Set both when a count has a unit — spelling the unit into every visible option is what made the +counted rows too wide to sit two-up in the first place. `hintLabel` alone is never enough: the +announced name must keep the unit. + Collapse rules, when they apply: groups start collapsed; a group holding a selection opens itself; an explicit user collapse beats that; an active needle forces every matched group open and owns openness. A selected option always survives the needle, so an active constraint can diff --git a/src/components/clinical-dashboard/document-search-results.tsx b/src/components/clinical-dashboard/document-search-results.tsx index 823ccfe481..74382da931 100644 --- a/src/components/clinical-dashboard/document-search-results.tsx +++ b/src/components/clinical-dashboard/document-search-results.tsx @@ -220,6 +220,14 @@ function loadedSourceCountHint(count: number) { return `${count.toLocaleString()} loaded ${count === 1 ? "source" : "sources"}`; } +// What the option DISPLAYS. The announced name keeps the full phrase above, so +// a reader still hears the unit; the visible column is a bare numeral. Spelling +// "0 loaded sources" seven times down a phone sheet made every option wide +// enough to wrap onto its own line and repeated the same two words in each one. +function loadedSourceCountLabel(count: number) { + return count.toLocaleString(); +} + function relevanceTone(document: DocumentMatch) { const verdict = document.relevance?.verdict as string | undefined; const percent = documentRelevancePercent(document); @@ -462,10 +470,10 @@ function DocumentResultMoreMenu({ }} className={cn( documentActionClass, - "min-h-12 w-full min-w-0 rounded-br-xl px-2 !text-sm font-bold text-[color:var(--text-heading)]", + "min-h-12 w-full min-w-0 rounded-br-xl px-2 !text-sm !font-semibold text-[color:var(--text)]", )} > -