Skip to content

Commit d32185f

Browse files
fix(web): restore full-width sheet rows, keep Commitment in the landmark
Wrapping the sheet's NavLinks in <li> left the anchors inline, so each row's tap target shrank to the width of its text. `block` on navLinkClass and on the two plain <a>s makes the rows full-width again. Swapping HelpWantedIndex's outer <aside> for a <div> removed the nested landmark but orphaned the Commitment heading and fieldset outside any landmark, since FacetSidebar renders its own aside[aria-label="Filters"] as a sibling. FacetSidebar now accepts children inside that aside, and Commitment rides there — still exactly one complementary landmark, and it holds every filter control. PeopleIndex and ProjectsIndex mount FacetSidebar directly and are unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
1 parent abfd1dd commit d32185f

4 files changed

Lines changed: 40 additions & 17 deletions

File tree

‎apps/web/src/components/AppHeader.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ function AboutDropdown() {
182182
);
183183
}
184184

185+
// `block` so each link fills its row: inside the sheet's <li>s an inline
186+
// anchor would shrink the tap target to the width of its text.
185187
const navLinkClass = ({ isActive }: { isActive: boolean }) =>
186-
`text-sm font-medium transition-colors hover:text-primary ${
188+
`block text-sm font-medium transition-colors hover:text-primary ${
187189
isActive ? 'text-primary' : 'text-muted-foreground'
188190
}`;
189191

@@ -368,7 +370,7 @@ export function AppHeader() {
368370
<li>
369371
<a
370372
href="mailto:hello@codeforphilly.org"
371-
className="text-sm font-medium text-muted-foreground hover:text-primary"
373+
className="block text-sm font-medium text-muted-foreground hover:text-primary"
372374
onClick={() => setMobileOpen(false)}
373375
>
374376
Contact
@@ -382,7 +384,7 @@ export function AppHeader() {
382384
href={GITHUB_URL}
383385
target="_blank"
384386
rel="noopener noreferrer"
385-
className="text-sm font-medium text-muted-foreground hover:text-primary"
387+
className="block text-sm font-medium text-muted-foreground hover:text-primary"
386388
onClick={() => setMobileOpen(false)}
387389
>
388390
GitHub

‎apps/web/src/components/FacetSidebar.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState } from 'react';
1+
import { useState, type ReactNode } from 'react';
22
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
33
import { TagChip } from '@/components/TagChip';
44
import { Link } from 'react-router';
@@ -12,6 +12,8 @@ interface FacetSidebarProps {
1212
tabs?: Array<'topic' | 'tech' | 'event'>;
1313
limit?: number;
1414
className?: string;
15+
/** Extra filter controls rendered inside the same `Filters` landmark. */
16+
children?: ReactNode;
1517
}
1618

1719
const NS_LABELS = {
@@ -40,6 +42,7 @@ export function FacetSidebar({
4042
tabs = ['topic', 'tech', 'event'],
4143
limit = 10,
4244
className,
45+
children,
4346
}: FacetSidebarProps) {
4447
const [tab, setTab] = useState<string>(tabs[0] ?? 'topic');
4548
const activeTagSet = new Set(activeTags);
@@ -103,6 +106,7 @@ export function FacetSidebar({
103106
);
104107
})}
105108
</Tabs>
109+
{children}
106110
</aside>
107111
);
108112
}

‎apps/web/src/screens/HelpWantedIndex.tsx‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,16 @@ export function HelpWantedIndex() {
109109
<PostRolePickerModal open={pickerOpen} onOpenChange={setPickerOpen} />
110110

111111
<div className="grid grid-cols-1 md:grid-cols-[16rem_1fr] gap-6">
112-
{/* A plain div, not an <aside>: FacetSidebar renders its own labelled
113-
<aside>, and wrapping it in another one nests two `complementary`
114-
landmarks — the outer one unlabelled. */}
115-
<div>
116-
<FacetSidebar
117-
facets={facets}
118-
activeTags={tags}
119-
onToggleTag={handleToggleTag}
120-
tabs={['tech', 'topic']}
121-
/>
122-
112+
{/* The Commitment radios ride inside FacetSidebar's own labelled
113+
<aside> rather than a second wrapper: one `complementary`
114+
landmark ("Filters") holds every filter control, and nothing is
115+
orphaned outside it. */}
116+
<FacetSidebar
117+
facets={facets}
118+
activeTags={tags}
119+
onToggleTag={handleToggleTag}
120+
tabs={['tech', 'topic']}
121+
>
123122
<div className="mt-6">
124123
<h2 className="text-xs font-semibold uppercase tracking-wide mb-2 text-muted-foreground">
125124
Commitment
@@ -151,7 +150,7 @@ export function HelpWantedIndex() {
151150
))}
152151
</fieldset>
153152
</div>
154-
</div>
153+
</FacetSidebar>
155154

156155
<div>
157156
{/* HelpWantedCard renders an h3 (it also sits under section h2s on

‎apps/web/tests/HelpWantedIndex.test.tsx‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
2-
import { screen, waitFor } from '@testing-library/react';
2+
import { screen, waitFor, within } from '@testing-library/react';
33
import { renderScreen, mockPaginated } from './test-utils.js';
44
import { HelpWantedIndex } from '../src/screens/HelpWantedIndex.js';
55
import { AuthProvider } from '../src/hooks/useAuth.js';
@@ -78,4 +78,22 @@ describe('HelpWantedIndex', () => {
7878
expect(screen.getByLabelText('≤ 5 hrs/week')).toBeInTheDocument();
7979
expect(screen.getByLabelText('≤ 10 hrs/week')).toBeInTheDocument();
8080
});
81+
82+
it('keeps every filter control inside the one Filters landmark', async () => {
83+
renderScreen(
84+
<AuthProvider>
85+
<HelpWantedIndex />
86+
</AuthProvider>,
87+
{ initialEntries: ['/help-wanted'] },
88+
);
89+
90+
const sidebars = await screen.findAllByRole('complementary');
91+
expect(sidebars).toHaveLength(1);
92+
const sidebar = sidebars[0]!;
93+
expect(sidebar).toHaveAccessibleName('Filters');
94+
// Commitment rides inside the same landmark as the tag facets rather
95+
// than sitting orphaned beside it.
96+
expect(within(sidebar).getByRole('heading', { name: 'Commitment', level: 2 })).toBeInTheDocument();
97+
expect(within(sidebar).getByLabelText('≤ 2 hrs/week')).toBeInTheDocument();
98+
});
8199
});

0 commit comments

Comments
 (0)