Skip to content

Commit f419c26

Browse files
fix(web): keep the Connect GitHub banner a region, announce it beside
Turning the banner into role="status" traded a landmark for a live region that mounts late — and a container that appears already populated is not announced reliably, while wrapping the two buttons in a status role is invalid content for it. Revert to region + aria-label and add a sibling sr-only role="status" span carrying the headline, the same idiom Sponsor and ProfileEdit use in this PR. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
1 parent d32185f commit f419c26

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ export function ConnectGitHubBanner() {
3030
if (dismissed) return null;
3131

3232
return (
33-
// role="status", not "region": the banner appears only once auth has
34-
// resolved, so it arrives after first paint and a landmark would never
35-
// announce it. The aria-label stays as its accessible name.
33+
<>
3634
<div
37-
role="status"
35+
role="region"
3836
aria-label="Connect GitHub"
3937
className="border-b border-primary/40 bg-primary/5 print:hidden"
4038
>
@@ -61,5 +59,14 @@ export function ConnectGitHubBanner() {
6159
</Button>
6260
</div>
6361
</div>
62+
{/* The banner mounts only once auth resolves, and a landmark arriving
63+
after first paint is never announced on its own — so mirror the
64+
headline in a live region (the Sponsor / ProfileEdit idiom). It stays
65+
a region rather than becoming one: a late-mounted status container
66+
is not read reliably either, and it would swallow the two buttons. */}
67+
<span role="status" className="sr-only">
68+
Connect your GitHub account
69+
</span>
70+
</>
6471
);
6572
}

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,24 @@ describe('ConnectGitHubBanner', () => {
7070
render();
7171
await waitFor(() => {
7272
expect(
73-
screen.getByRole('status', { name: /connect github/i }),
73+
screen.getByRole('region', { name: /connect github/i }),
7474
).toBeInTheDocument();
7575
});
7676
// CTA form posts to the link endpoint.
77-
const region = screen.getByRole('status', { name: /connect github/i });
77+
const region = screen.getByRole('region', { name: /connect github/i });
7878
expect(region.querySelector('form[action="/api/auth/link-github"]')).not.toBeNull();
7979
expect(screen.getByRole('button', { name: /dismiss/i })).toBeInTheDocument();
80+
// The landmark mounts after first paint, so its arrival is announced
81+
// through a sibling live region carrying the headline.
82+
expect(screen.getByRole('status')).toHaveTextContent('Connect your GitHub account');
8083
});
8184

8285
it('renders for a user whose session was minted via password reset', async () => {
8386
mockMe({ ...baseLegacyPerson, lastLoginMethod: 'password_reset' });
8487
render();
8588
await waitFor(() => {
8689
expect(
87-
screen.getByRole('status', { name: /connect github/i }),
90+
screen.getByRole('region', { name: /connect github/i }),
8891
).toBeInTheDocument();
8992
});
9093
});
@@ -101,7 +104,7 @@ describe('ConnectGitHubBanner', () => {
101104
// microtask gap.
102105
await new Promise((r) => setTimeout(r, 0));
103106
expect(
104-
screen.queryByRole('status', { name: /connect github/i }),
107+
screen.queryByRole('region', { name: /connect github/i }),
105108
).not.toBeInTheDocument();
106109
});
107110

@@ -110,7 +113,7 @@ describe('ConnectGitHubBanner', () => {
110113
render();
111114
await new Promise((r) => setTimeout(r, 0));
112115
expect(
113-
screen.queryByRole('status', { name: /connect github/i }),
116+
screen.queryByRole('region', { name: /connect github/i }),
114117
).not.toBeInTheDocument();
115118
});
116119

@@ -121,7 +124,7 @@ describe('ConnectGitHubBanner', () => {
121124
fireEvent.click(dismissBtn);
122125
await waitFor(() => {
123126
expect(
124-
screen.queryByRole('status', { name: /connect github/i }),
127+
screen.queryByRole('region', { name: /connect github/i }),
125128
).not.toBeInTheDocument();
126129
});
127130
});

0 commit comments

Comments
 (0)