Search Input UX Policy (Canonical)¶
This is the canonical rule for search and filter input UX across LMS, CMS, and shared UI surfaces.
Scope¶
- Applies to search/filter bars in list pages, admin screens, workarea panels, dialogs, sidebars, and import pickers.
- Does not apply to full forms. Full-form labeling/layout remains governed by
056-full-form-ux-policy.mdc.
Core Contract¶
- Use shadcn
Inputfor search controls. - Put guidance text in the input
placeholder. - Add a localized
aria-labelon each search input. - Prefer
type="search"for search semantics. - Keep search icon + clear button affordance where already used.
- Clear buttons must use
type="button"and a localizedaria-label(typicallyaccessibility.clearSearch).
Consistency Requirements¶
- Do not render standalone helper text above a search field when that text is intended as in-field guidance.
- Preserve existing behavior when migrating:
- query param contracts (
searchor field-specific filters), - submit semantics and URL state,
- pagination behavior,
- stable
data-testidhooks.
- query param contracts (
Implementation Guidance¶
- For client-rendered list surfaces, prefer the shared
@open-learning-hub/ui/search-inputprimitive to keep icon/clear/testid behavior consistent. - For server-rendered LMS list pages that use
<form method="get">, keep the existing server-first pattern (Input type="search"+aria-label) and avoid client conversions solely for search UI reuse.
Multi-Field Free-Text Search¶
- When one free-text value searches or filters multiple database fields, use a single search input.
- Apply that query server-side with an
ORcondition across the relevant fields. - Do not split free-text filtering into parallel text fields such as
action,actor, andtenantunless product explicitly requires separate structured filters. - Keep constrained filters separate when the input is not free text, such as status, role, or type dropdowns.
- Preserve tenant, permission, and other authorization scopes outside the broad search
ORcondition.
i18n Guidance¶
- Prefer distinct keys when copy intent differs:
searchPlaceholderfor visible guidance,searchLabel(or equivalent) foraria-label.
- Reusing one key for both is allowed when product copy is intentionally identical.
Accessibility + Testing¶
- Search bars may use placeholder +
aria-labelwithout a visible label when they are listing/filter controls (not full forms). - Add or update tests for changed search controls to cover:
- placeholder text,
aria-labelpresence,- clear-button
aria-label, - unchanged filter/query behavior.
Reference Implementations¶
apps/lms/src/app/\[locale\]/admin/tenants/_components/tenants-manager.tsxapps/lms/src/app/\[locale\]/admin/users/page.tsxapps/lms/src/app/\[locale\]/admin/audit/page.tsxapps/cms/src/components/widgets/shared/asset-picker-dialog.tsxapps/cms/src/components/workarea/import-pages.tsx