Skip to content

Commit dfbd37b

Browse files
docs-botCopilot
andauthored
a11y: fix status messages, focus-not-obscured, and journey nav labels (#61379)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a8a7c61 commit dfbd37b

3 files changed

Lines changed: 34 additions & 8 deletions

File tree

src/frame/components/ui/ScrollButton/ScrollButton.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
5454
return () => window.removeEventListener('resize', updateDocumentSize)
5555
}, [])
5656

57+
const isVisible = show && isTallEnough
58+
5759
const onClick = () => {
5860
document?.getElementById('github-logo')?.focus()
5961
document?.getElementById('main-content')?.scrollIntoView()
@@ -62,10 +64,12 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
6264
return (
6365
<div
6466
role="tooltip"
65-
className={cx(className, transition200, show && isTallEnough ? opacity100 : opacity0)}
67+
className={cx(className, transition200, isVisible ? opacity100 : opacity0)}
68+
aria-hidden={!isVisible}
6669
>
6770
<button
6871
onClick={onClick}
72+
tabIndex={isVisible ? 0 : -1}
6973
className={cx(
7074
'ghd-scroll-to-top', // for data tracking, see events.ts
7175
'tooltipped tooltipped-n tooltipped-no-delay btn circle border-1',

src/journeys/components/JourneyTrackNav.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ export function JourneyTrackNav({ context }: Props) {
1818
<span className="f5 d-flex flex-column">
1919
{prevGuide && (
2020
<>
21-
<span className="color-fg-default">{t('prev_article')}</span>
22-
<Link href={prevGuide.href} className="text-bold color-fg">
21+
<span className="color-fg-default" aria-hidden="true">
22+
{t('prev_article')}
23+
</span>
24+
<Link
25+
href={prevGuide.href}
26+
className="text-bold color-fg"
27+
aria-label={`${t('prev_article')}: ${prevGuide.title}`}
28+
>
2329
{prevGuide.title}
2430
</Link>
2531
</>
@@ -29,15 +35,27 @@ export function JourneyTrackNav({ context }: Props) {
2935
<span className="f5 d-flex flex-column flex-items-end">
3036
{nextGuide ? (
3137
<>
32-
<span className="color-fg-default">{t('next_article')}</span>
33-
<Link href={nextGuide.href} className="text-bold color-fg text-right">
38+
<span className="color-fg-default" aria-hidden="true">
39+
{t('next_article')}
40+
</span>
41+
<Link
42+
href={nextGuide.href}
43+
className="text-bold color-fg text-right"
44+
aria-label={`${t('next_article')}: ${nextGuide.title}`}
45+
>
3446
{nextGuide.title}
3547
</Link>
3648
</>
3749
) : nextTrackFirstGuide ? (
3850
<>
39-
<span className="color-fg-default">{t('next_article')}</span>
40-
<Link href={nextTrackFirstGuide.href} className="text-bold color-fg text-right">
51+
<span className="color-fg-default" aria-hidden="true">
52+
{t('next_article')}
53+
</span>
54+
<Link
55+
href={nextTrackFirstGuide.href}
56+
className="text-bold color-fg text-right"
57+
aria-label={`${t('next_article')}: ${nextTrackFirstGuide.trackTitle}`}
58+
>
4159
{nextTrackFirstGuide.trackTitle}
4260
</Link>
4361
</>

src/landings/components/shared/LandingArticleGridWithFilter.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ export const ArticleGrid = ({
294294
/>
295295
))}
296296
{filteredResults.length === 0 && (
297-
<div className={styles.noArticlesContainer} data-testid="no-articles-message">
297+
<div
298+
role="status"
299+
className={styles.noArticlesContainer}
300+
data-testid="no-articles-message"
301+
>
298302
<p className={styles.noArticlesText}>{t('article_grid.no_articles_found')}</p>
299303
</div>
300304
)}

0 commit comments

Comments
 (0)