B103 — omit Sugestões heading in home search suggest mode

Hide the visible h2 when resultKind is suggest; keep aria-label on the
section for screen readers. Search mode still shows Municípios heading.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-08-01 18:11:14 +00:00
parent aae788a64c
commit 259488fd33
No known key found for this signature in database
2 changed files with 30 additions and 1 deletions

View file

@ -26,10 +26,11 @@ export const HomeSearchMunicipalityGroup = () => {
if (visibleMunicipalities.length === 0 && visibleTerritories.length === 0) return null
const sectionTitle = resultKind === 'suggest' ? 'Sugestões' : 'Municípios'
const showHeading = resultKind !== 'suggest'
return (
<section aria-label={sectionTitle} className="flex flex-col gap-0.5">
<h2 className={HOME_SEARCH_GROUP_HEADING_CLASS}>{sectionTitle}</h2>
{showHeading ? <h2 className={HOME_SEARCH_GROUP_HEADING_CLASS}>{sectionTitle}</h2> : null}
<ul className={HOME_SEARCH_GROUP_LIST_CLASS}>
{visibleMunicipalities.map((hit) => (
<li key={`municipality-${hit.slug}`}>

View file

@ -55,6 +55,34 @@ describe('HomeSearchHitRow', () => {
})
describe('HomeSearchMunicipalityGroup', () => {
it('omits the visible heading in suggest mode while keeping an accessible section name', () => {
render(
<HomeSearchResultsProvider
value={searchResultsValue(
{
municipalities: [
{
kind: 'municipality',
slug: 'cairu',
name: 'Cairu',
region: 'Recôncavo',
priority: null,
votePosition2022: null,
},
],
},
'suggest',
)}
>
<HomeSearchMunicipalityGroup />
</HomeSearchResultsProvider>,
)
expect(screen.queryByRole('heading', { name: 'Sugestões' })).toBeNull()
expect(screen.getByRole('region', { name: 'Sugestões' })).toBeTruthy()
expect(screen.getByRole('link', { name: /Cairu/i })).toBeTruthy()
})
it('renders a discreet sentence-case heading and list without bullets', () => {
const { container } = render(
<HomeSearchResultsProvider