diff --git a/frontend/src/components/ActiveFilterChips.tsx b/frontend/src/components/ActiveFilterChips.tsx index a90446ad..cfc909c7 100644 --- a/frontend/src/components/ActiveFilterChips.tsx +++ b/frontend/src/components/ActiveFilterChips.tsx @@ -2,6 +2,7 @@ import { useLayoutEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { Filter, X } from "lucide-react"; import type { ActiveFilter } from "../lib/useActiveFilters"; +import { decideChipLayout } from "../lib/chipOverflow"; import { PopoverItem, PopoverSurface, useAnchoredPopover } from "./AnchoredPopover"; // The applied-filter row above the feed: every narrowing currently in force, each removable on its @@ -18,7 +19,6 @@ import { PopoverItem, PopoverSurface, useAnchoredPopover } from "./AnchoredPopov // Below this lane width an overflow collapses all the way to a single count pill (mobile), instead of // the "fit some + N more" treatment used on wider lanes. const NARROW_PX = 420; -const GAP_PX = 6; // matches gap-1.5 (px) const chipCls = "chip group inline-flex items-center gap-1 pl-2.5 pr-1.5 py-1 text-sm whitespace-nowrap hover:border-accent hover:bg-accent/20 transition"; @@ -43,11 +43,15 @@ function ChipButton({ f, testId }: { f: ActiveFilter; testId?: string }) { // The "+N" / "N filters" pill and its popover listing the (overflowed / all) chips, each removable. function OverflowPopover({ label, + ariaLabel, chips, onClearAll, icon, }: { label: string; + /** Accessible name for the trigger + popover — describes what's inside (e.g. "3 more filters"), + * since the visible label can be a bare "+3". Defaults to `label`. */ + ariaLabel?: string; chips: ActiveFilter[]; onClearAll: () => void; icon?: boolean; @@ -60,12 +64,14 @@ function OverflowPopover({ mode: "menu", placement: "bottom-end", }); + const name = ariaLabel ?? label; return ( <>