Skip to content

Commit cddfcbc

Browse files
authored
Merge pull request #244 from cnumr/cms
chore: sync avec origin/main
2 parents 0fd1456 + 735dda0 commit cddfcbc

5 files changed

Lines changed: 47 additions & 14 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'gen-referentiel-core': patch
3+
---
4+
5+
fix: améliore l'accessibilité des cards et corrige le tooltip du bouton info
6+
7+
- Déplace le lien de la card entière vers le titre uniquement (card-view.tsx) pour respecter les bonnes pratiques a11y (un lien ne doit pas englober toute une card interactive)
8+
- Ajoute un overlay invisible (`aria-hidden`, `tabIndex=-1`) pour maintenir la surface de clic sur toute la card
9+
- Déplace le lien sur le titre dans FicheCard (Card.tsx) avec `z-10` pour rester au-dessus de l'overlay
10+
- Corrige l'affichage du tooltip natif du bouton (i) en ajoutant `pointer-events-none` sur le SVG enfant, permettant au navigateur de cibler le `<button>` et d'afficher son attribut `title`

‎.changeset/sync-cms.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎components/card-view.tsx‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,35 @@ const CardView: FunctionComponent<CardViewProps> = ({
3030
layoutClass = 'h-full flex-col divide-y-2 divide-primary';
3131
}
3232

33+
const href = `${type === CardType.FICHES ? 'fiches/' : ''}${entry.node._sys.filename}`;
34+
3335
return (
34-
<li className="tohide box interactive border-neutral-transparent py-2 transition-all md:py-6">
36+
<li className="tohide box interactive relative border-neutral-transparent py-2 transition-all md:py-6">
37+
{/* Overlay pour étendre la surface de clic à toute la carte — aria-hidden et tabIndex=-1 pour l'a11y */}
3538
<Link
36-
href={`${type === CardType.FICHES && 'fiches/'}${entry.node._sys.filename}`}
37-
className={`flex no-underline h-full ${layoutClass}`}
38-
title={`Voir la fiche : ${entry.node.title}`}>
39+
href={href}
40+
className="absolute inset-0 z-0"
41+
aria-hidden="true"
42+
tabIndex={-1}
43+
/>
44+
<div className={`flex h-full ${layoutClass}`}>
3945
{type === CardType.FICHES ? (
4046
<FicheCard
4147
item={entry}
4248
lang={lang}
49+
href={href}
4350
/>
4451
) : (
45-
<h3 className="mt-0">{entry.node.title}</h3>
52+
<h3 className="mt-0">
53+
<Link
54+
href={href}
55+
className="relative z-10 no-underline"
56+
title={`Voir la fiche : ${entry.node.title}`}>
57+
{entry.node.title}
58+
</Link>
59+
</h3>
4660
)}
47-
</Link>
61+
</div>
4862
</li>
4963
);
5064
};

‎components/pages/fiche/Card.tsx‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ import {
1010
import { isStringInUi, useTranslations } from '../../../i18n/utils';
1111

1212
import { FunctionComponent } from 'react';
13+
import Link from 'next/link';
1314
import { slugify } from '../../../src/js/utils';
1415
import { ui } from '../../../i18n/ui';
1516

1617
interface FicheCardProps {
1718
item: FichesConnectionEdges;
1819
lang?: keyof typeof ui;
20+
href: string;
1921
}
2022

2123
const PUBLIC_BASE = process.env.PUBLIC_BASE ? process.env.PUBLIC_BASE : '';
@@ -26,6 +28,7 @@ const REF_NAME = process.env.NEXT_PUBLIC_REF_NAME
2628
export const FicheCard: FunctionComponent<FicheCardProps> = ({
2729
item,
2830
lang = 'fr',
31+
href,
2932
}) => {
3033
const fiche: any = item.node;
3134

@@ -168,11 +171,16 @@ export const FicheCard: FunctionComponent<FicheCardProps> = ({
168171
{REF_NAME}
169172
{fiche.refID}
170173
</span>
171-
<span className="flex-auto">{fiche.title}</span>
174+
<Link
175+
href={href}
176+
className="relative z-10 flex-auto no-underline"
177+
title={`Voir la fiche : ${fiche.title}`}>
178+
{fiche.title}
179+
</Link>
172180
<button
173181
role="img"
174182
title={getMetas()}
175-
className="size-6 flex-none text-primary">
183+
className="relative z-10 size-6 flex-none text-primary">
176184
<svg
177185
stroke="currentColor"
178186
fill="none"
@@ -182,7 +190,7 @@ export const FicheCard: FunctionComponent<FicheCardProps> = ({
182190
height="200px"
183191
width="200px"
184192
xmlns="http://www.w3.org/2000/svg"
185-
className="size-6">
193+
className="pointer-events-none size-6">
186194
<path
187195
strokeLinecap="round"
188196
strokeLinejoin="round"

‎scripts/sync-upstream.sh‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ git reset HEAD -- $PROTECTED_PATHS 2>/dev/null || true
5959
git checkout HEAD -- $PROTECTED_PATHS 2>/dev/null || true
6060
git clean -fd -- $PROTECTED_PATHS 2>/dev/null || true
6161

62+
# Restaurer uniquement le champ name du package.json local (version est celle d'upstream)
63+
echo -e "${YELLOW}Restauration du champ name dans package.json...${NC}"
64+
LOCAL_NAME=$(git show HEAD:package.json | node -e "let d=''; process.stdin.resume().on('data', c => d+=c).on('end', () => console.log(JSON.parse(d).name));")
65+
node -e "const fs=require('fs'); const p=JSON.parse(fs.readFileSync('package.json','utf8')); p.name='$LOCAL_NAME'; fs.writeFileSync('package.json', JSON.stringify(p, null, 2)+'\n');"
66+
git add package.json
67+
6268
# Commit du merge
6369
echo -e "${YELLOW}Commit du merge...${NC}"
6470
git commit -m "chore: sync upstream (contenu local préservé)" || {

0 commit comments

Comments
 (0)