Skip to content

Commit 8c8bcf4

Browse files
fix: SEO and accessibility improvements
1 parent 1c53dd9 commit 8c8bcf4

File tree

24 files changed

+179
-95
lines changed

24 files changed

+179
-95
lines changed

.changeset/ten-students-fail.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@o2s/integrations.strapi-cms': patch
3+
'@o2s/integrations.mocked': patch
4+
'@o2s/framework': patch
5+
'@o2s/frontend': patch
6+
'@o2s/ui': patch
7+
---
8+
9+
SEO and accessibility improvements

apps/frontend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"formik": "^2.4.6",
2727
"jsonwebtoken": "^9.0.2",
2828
"markdown-to-jsx": "^7.7.3",
29-
"next": "^15.1.3",
29+
"next": "15.2.1",
3030
"next-auth": "^5.0.0-beta.25",
3131
"next-compose-plugins": "^2.2.1",
3232
"next-intl": "^3.26.1",
@@ -42,7 +42,7 @@
4242
"@o2s/eslint-config": "*",
4343
"@o2s/prettier-config": "*",
4444
"@o2s/typescript-config": "*",
45-
"@next/bundle-analyzer": "^15.0.4",
45+
"@next/bundle-analyzer": "15.2.1",
4646
"@svgr/webpack": "^8.1.0",
4747
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
4848
"@types/bcryptjs": "^2.4.6",
@@ -53,7 +53,7 @@
5353
"@types/react-dom": "19.0.0",
5454
"dotenv": "^16.4.7",
5555
"eslint": "^8",
56-
"eslint-config-next": "15.0.3",
56+
"eslint-config-next": "15.2.1",
5757
"postcss": "^8",
5858
"prettier": "^3.4.0",
5959
"prisma": "^6.3.1",

apps/frontend/src/components/Filters/Filters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const Filters = <T, S extends FormikValues>({
5353
</Button>
5454
</div>
5555
<Sheet open={filtersOpen} onOpenChange={setFiltersOpen}>
56-
<SheetContent>
56+
<SheetContent closeLabel={filters.close}>
5757
<SheetHeader>
5858
<SheetTitle>{title}</SheetTitle>
5959
{description && <SheetDescription>{description}</SheetDescription>}

apps/frontend/src/components/Footer/Footer.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useLocale } from 'next-intl';
44
import Image from 'next/image';
5+
import { JSX } from 'react';
56

67
import { Models } from '@o2s/framework/modules';
78

@@ -92,14 +93,18 @@ export const Footer: React.FC<FooterProps> = ({ data }) => {
9293

9394
const AccordionItemTemplate = ({
9495
item,
96+
tag,
9597
children,
9698
}: {
9799
item: Models.Navigation.NavigationGroup;
100+
tag: keyof JSX.IntrinsicElements;
98101
children: React.ReactNode;
99102
}) => {
100103
return (
101104
<AccordionItem value={item.title} className="border-none">
102-
<AccordionTrigger className={mobileNavigationItemClass}>{item.title}</AccordionTrigger>
105+
<AccordionTrigger className={mobileNavigationItemClass} tag={tag}>
106+
{item.title}
107+
</AccordionTrigger>
103108
<AccordionContent className="p-0">{children}</AccordionContent>
104109
</AccordionItem>
105110
);
@@ -119,7 +124,7 @@ export const Footer: React.FC<FooterProps> = ({ data }) => {
119124

120125
const NavigationGroup = ({ item }: { item: Models.Navigation.NavigationGroup }) => {
121126
return (
122-
<AccordionItemTemplate item={item}>
127+
<AccordionItemTemplate item={item} tag="h3">
123128
<ul className="flex flex-col items-start gap-2 w-full pt-2 pl-3">
124129
{item.items.map((item) => {
125130
switch (item.__typename) {
@@ -129,7 +134,7 @@ export const Footer: React.FC<FooterProps> = ({ data }) => {
129134
return (
130135
<li key={item.title} className="w-full list-none">
131136
<Accordion type="multiple" className="flex flex-col gap-2">
132-
<AccordionItemTemplate item={item}>
137+
<AccordionItemTemplate item={item} tag="h4">
133138
<ul className="flex flex-col items-start gap-2 w-full pt-2 pl-3">
134139
{item.items.map((item) => {
135140
if (item.__typename !== 'NavigationItem') {
@@ -194,7 +199,7 @@ export const Footer: React.FC<FooterProps> = ({ data }) => {
194199
<Separator />
195200
<div className="w-full m-auto max-w-7xl flex flex-col md:hidden">
196201
<Accordion type="multiple" className="flex flex-col gap-2 p-2">
197-
<AccordionItemTemplate item={data as unknown as Models.Navigation.NavigationGroup}>
202+
<AccordionItemTemplate item={data as unknown as Models.Navigation.NavigationGroup} tag="h2">
198203
<Accordion type="multiple" className="flex flex-col gap-2 pt-2 pl-3">
199204
{data.items.map((item) => {
200205
switch (item.__typename) {

apps/frontend/src/components/Header/ContextSwitcher/ContextSwitcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const ContextSwitcher = ({ context }: ContextSwitcherProps) => {
3333
</Button>
3434
</SheetTrigger>
3535

36-
<SheetContent>
36+
<SheetContent closeLabel={context.close}>
3737
<div className="flex flex-col gap-6">
3838
<SheetHeader>
3939
<SheetTitle asChild>

apps/frontend/src/components/Header/Header.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const Header: React.FC<HeaderProps> = ({ headerData, alternativeUrls, chi
8282
userSlot={<UserSlot />}
8383
items={headerData.items}
8484
title={headerData.title}
85+
mobileMenuLabel={headerData.mobileMenuLabel}
8586
/>
8687
</div>
8788
</>

apps/frontend/src/components/Header/MobileNavigation/MobileNavigation.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export function MobileNavigation({
2727
userSlot,
2828
items,
2929
title,
30+
mobileMenuLabel,
3031
}: MobileNavigationProps) {
3132
const locale = useLocale();
3233

@@ -119,11 +120,15 @@ export function MobileNavigation({
119120
size="icon"
120121
className="h-10 w-10"
121122
onClick={() => setIsMenuOpen((prev) => !prev)}
123+
aria-label={mobileMenuLabel.open}
122124
>
123125
{isMenuOpen ? <X className="w-4 h-4" /> : <Menu className="w-4 h-4" />}
124126
</Button>
125127
</SheetTrigger>
126-
<SheetContent className="max-w-full w-full md:max-w-sm sm:max-w-full">
128+
<SheetContent
129+
className="max-w-full w-full md:max-w-sm sm:max-w-full"
130+
closeLabel={mobileMenuLabel.close}
131+
>
127132
<SheetHeader className="mt-2">
128133
<SheetTitle className="text-center sr-only" asChild>
129134
<Typography variant="h2" asChild>

apps/frontend/src/components/Header/MobileNavigation/MobileNavigation.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export interface MobileNavigationProps {
1010
userSlot?: ReactNode;
1111
items: CMS.Model.Header.Header['items'];
1212
title?: CMS.Model.Header.Header['title'];
13+
mobileMenuLabel: CMS.Model.Header.Header['mobileMenuLabel'];
1314
}

apps/frontend/src/utils/seo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const generateSeo = ({
3636
alternates,
3737
}: SEOProps): Metadata => {
3838
const pageSlug = slug;
39-
const url = `${SITE_URL}${locale === DEFAULT_LOCALE ? '' : `/${locale}`}${slug}`;
39+
const url = `${SITE_URL}/${locale}${slug}`;
4040
const id = pageSlug.split('/')[2] || '';
4141

4242
return {

0 commit comments

Comments
 (0)