Skip to content

Commit f9638a5

Browse files
committed
fix: improve accessibility and semantic structure
- Add skip-link for keyboard navigation - Fix heading hierarchy (h1 in Hero, remove duplicate from Header) - Add aria-expanded and aria-controls to menu toggle - Add focus-visible styles and respect prefers-reduced-motion - Add theme-color meta and scroll-margin for section anchors
1 parent 964f31b commit f9638a5

12 files changed

Lines changed: 76 additions & 15 deletions

File tree

src/components/Header.astro

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const altUrl = getAlternateUrl(path, altLang);
1717

1818
<header>
1919
<div class="container">
20-
<a href={lang === 'ru' ? '/ru' : '/'} class="logo-link">
20+
<a href={lang === 'ru' ? '/ru' : '/'} class="logo-link" aria-label="NurOS — Home">
2121
<div class="logo">
22-
<h1>NurOS</h1>
22+
<span class="logo-text">NurOS</span>
2323
</div>
2424
</a>
2525

@@ -55,7 +55,7 @@ const altUrl = getAlternateUrl(path, altLang);
5555
<a href={getAlternateUrl(path, 'en')} class:list={[{ active: lang === 'en' }]}>EN</a>
5656
<a href={getAlternateUrl(path, 'ru')} class:list={[{ active: lang === 'ru' }]}>RU</a>
5757
</div>
58-
<button class="menu-toggle" id="menu-toggle" aria-label="Menu">
58+
<button class="menu-toggle" id="menu-toggle" aria-label="Menu" aria-expanded="false" aria-controls="main-nav">
5959
<span></span>
6060
<span></span>
6161
</button>
@@ -67,8 +67,14 @@ const altUrl = getAlternateUrl(path, altLang);
6767
const toggle = document.getElementById('menu-toggle');
6868
const nav = document.getElementById('main-nav');
6969

70-
toggle?.addEventListener('click', () => nav?.classList.toggle('active'));
71-
nav?.querySelectorAll('a').forEach((l) => l.addEventListener('click', () => nav.classList.remove('active')));
70+
toggle?.addEventListener('click', () => {
71+
const open = nav?.classList.toggle('active');
72+
toggle.setAttribute('aria-expanded', String(!!open));
73+
});
74+
nav?.querySelectorAll('a').forEach((l) => l.addEventListener('click', () => {
75+
nav.classList.remove('active');
76+
toggle?.setAttribute('aria-expanded', 'false');
77+
}));
7278

7379
document.querySelectorAll('nav a[href^="#"]').forEach((link) => {
7480
link.addEventListener('click', (e) => {
@@ -96,7 +102,7 @@ const altUrl = getAlternateUrl(path, altLang);
96102

97103
.logo-link { text-decoration: none; opacity: 1; }
98104
.logo-link:hover { opacity: 1; }
99-
.logo h1 { font-size: 1.5rem; font-weight: 600; color: var(--text-color); line-height: 1.2; }
105+
.logo-text { font-size: 1.5rem; font-weight: 600; color: var(--text-color); line-height: 1.2; }
100106
.tagline { font-size: 0.875rem; color: var(--accent-color); }
101107

102108
nav ul { display: flex; list-style: none; margin: 0; padding: 0; }

src/components/Hero.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const t = useTranslations(lang);
77
<section id="home" class="hero">
88
<div class="container">
99
<div class="hero-content">
10-
<h2 class="hero-title">NurOS <span class="hero-title-accent">"Juldyz"</span></h2>
10+
<h1 class="hero-title">NurOS <span class="hero-title-accent">"Juldyz"</span></h1>
1111
<p class="hero-subtitle">{t('hero.subtitle')}</p>
1212
<div class="cta-buttons">
1313
<a href={lang === 'ru' ? '/ru/releases' : '/releases'} class="btn hero-btn">{t('hero.cta')}</a>

src/layouts/BlogLayout.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ const lang = getLangFromUrl(Astro.url);
2323
<meta charset="UTF-8" />
2424
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2525
<meta name="description" content={description} />
26+
<meta name="theme-color" content="#0d0d0d" />
2627
<link rel="icon" href="/favicon.png" type="image/png" />
2728
<title>{title}</title>
2829
</head>
2930
<body>
31+
<a href="#main-content" class="skip-link">Skip to main content</a>
3032
<div class="blog-app">
3133
<Header />
32-
<main>
34+
<main id="main-content">
3335
<slot />
3436
</main>
3537
<Footer />

src/layouts/MainLayout.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ const lang = getLangFromUrl(Astro.url);
2121
<meta charset="UTF-8" />
2222
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2323
<meta name="description" content={description} />
24+
<meta name="theme-color" content="#0d0d0d" />
2425
<link rel="icon" href="/favicon.png" type="image/png" />
2526
<title>{title}</title>
2627
</head>
2728
<body>
29+
<a href="#main-content" class="skip-link">Skip to main content</a>
2830
<slot />
2931
</body>
3032
</html>

src/pages/404.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Footer from '../components/Footer.astro';
77
<MainLayout title="404 — NurOS" description="Page not found">
88
<div class="nuros-app">
99
<Header />
10-
<main class="not-found">
10+
<main id="main-content" class="not-found">
1111
<div class="container">
1212
<div class="not-found-inner">
1313
<p class="code">404</p>

src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Footer from '../components/Footer.astro';
1212
<MainLayout>
1313
<div class="nuros-app">
1414
<Header />
15-
<main>
15+
<main id="main-content">
1616
<Hero />
1717
<About />
1818
<Features />

src/pages/releases.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const t = useTranslations(lang);
1111
<MainLayout title={`${t('download.title')} — NurOS`} description={t('download.subtitle')}>
1212
<div class="nuros-app">
1313
<Header />
14-
<main class="dl-page">
14+
<main id="main-content" class="dl-page">
1515
<div class="container">
1616

1717
<div class="dl-header">

src/pages/ru/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Footer from '../../components/Footer.astro';
1212
<MainLayout title="NurOS" description="Независимый Linux дистрибутив">
1313
<div class="nuros-app">
1414
<Header />
15-
<main>
15+
<main id="main-content">
1616
<Hero />
1717
<About />
1818
<Features />

src/pages/ru/releases.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const t = useTranslations(lang);
1111
<MainLayout title={`${t('download.title')} — NurOS`} description={t('download.subtitle')}>
1212
<div class="nuros-app">
1313
<Header />
14-
<main class="dl-page">
14+
<main id="main-content" class="dl-page">
1515
<div class="container">
1616

1717
<div class="dl-header">

src/pages/ru/team.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Footer from '../../components/Footer.astro';
99
<MainLayout title="Команда — NurOS" description="Познакомьтесь с командой NurOS и присоединяйтесь к нам">
1010
<div class="nuros-app">
1111
<Header />
12-
<main class="team-page">
12+
<main id="main-content" class="team-page">
1313
<Team />
1414
<Contact />
1515
</main>

0 commit comments

Comments
 (0)