feat: add <ContentMedia /> component (img, svg, iframe, video, audio) - #512
feat: add <ContentMedia /> component (img, svg, iframe, video, audio)#512habbichelotfi wants to merge 3 commits into
Conversation
|
@habbichelotfi Merci pour cette PR. Le découpage des props par Vérifié en local sur Bloquant
Le lien de légende peut être rendu sans nom accessible. À discuterSVG non enveloppé dans Variantes de taille et ratios absents : pas de prop pour OptionnelLe diff modifie Rien à signaler côté sécurité. |
| /** Text of the optional link inside the figcaption. */ | ||
| captionLinkLabel?: ReactNode; | ||
| /** Props of the optional link inside the figcaption. */ | ||
| captionLinkProps?: RegisteredLinkProps; |
There was a problem hiding this comment.
Ces deux props sont indépendantes alors qu'elles n'ont de sens qu'ensemble : captionLinkProps sans captionLinkLabel rend <a class="fr-link"></a>, un lien sans nom accessible (RGAA 6.1, WCAG 2.4.4). Le composant n'étant pas encore publié, l'appariement peut se faire au niveau du type sans coût de migration.
| /** Text of the optional link inside the figcaption. */ | |
| captionLinkLabel?: ReactNode; | |
| /** Props of the optional link inside the figcaption. */ | |
| captionLinkProps?: RegisteredLinkProps; | |
| /** Label and props of the optional link inside the figcaption. Both go together. */ | |
| captionLink?: { | |
| label: ReactNode; | |
| linkProps: RegisteredLinkProps; | |
| }; |
La suggestion ne peut pas porter le site de rendu : il faut aussi remplacer les lignes 178-181 par un test sur captionLink et adapter les stories ainsi que test/integration/vite/src/Home.tsx.
|
Une info qui te concerne, @habbichelotfi. Beau composant, la couverture des cinq types de média est complète. #515 ajoute un test d'exhaustivité sur J'ai poussé cette entrée sur ta branche dans d095b52 plutôt que de te laisser avec une CI rouge : "ContentMedia": ["content", "link"],
Un changement connexe bon à savoir : #515 retire aussi Édité pour traduction. Deux références mises à jour au passage : #515 a été mergée depuis, le 30/08, et le commit cité était |
|
Correction sur mon commentaire précédent : Le fichier a été renommé en Surtout, |
A module absent from REACT_DSFR_MODULE_TO_DSFR_COMPONENTS resolves to undefined, which trips the include-everything fail-safe: the script warns, exits 0, and trims no CSS at all for any project importing it. content for the fr-content-media markup, link for the fr-link the caption renders.
b7e2d6a to
d095b52
Compare
|
@kevbarns merci pour le retour, Done in 5.74s. |
- Add support for sm and lg media sizes - Add ratio prop for image and SVG media - Wrap SVGs in media container to support DSFR ratio utilities - Simplify caption link API with a single captionLink prop - Enforce accessible caption links by requiring label and link props together - Update stories and integration examples
3f81660 to
ccb3442
Compare
Closes #511
Contexte
Cette PR implémente le composant
ContentMediaconformément à la structure DSFR pour l’intégration de médias accessibles et responsives.Ce qui est inclus
ContentMediacaption)captionLinkProps)Détails d’implémentation
figure/figcaptiontarget="_blank"+rel="noopener noreferrer")Vérifications
ContentMediaajoutées et documentées