feat: add <ContentMedia /> component (img, svg, iframe, video, audio) - #512
feat: add <ContentMedia /> component (img, svg, iframe, video, audio)#512habbichelotfi wants to merge 2 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.
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.
|
Heads-up on something coming your way, @habbichelotfi. Nice component, the coverage of the five media types is thorough. #515 adds an exhaustiveness test over I pushed that entry to your branch in 9b75139 rather than leave you with a red CI: "ContentMedia": ["content", "link"],
One related change worth knowing about: #515 also drops |
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