From 2fbbd1a2849053245ca3c52694a438cbfd9c1681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanislas=20Ormi=C3=A8res?= Date: Sun, 15 Sep 2024 13:01:53 +0200 Subject: [PATCH 1/5] =?UTF-8?q?feat(DsfrFooter):=20=E2=9C=A8=20g=C3=A8re?= =?UTF-8?q?=20l=E2=80=99attribut=20title=20des=20liens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #884 --- src/components/DsfrFooter/DsfrFooter.types.ts | 7 +++--- src/components/DsfrFooter/DsfrFooter.vue | 24 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/components/DsfrFooter/DsfrFooter.types.ts b/src/components/DsfrFooter/DsfrFooter.types.ts index 730d1f7d..d3b2ac81 100644 --- a/src/components/DsfrFooter/DsfrFooter.types.ts +++ b/src/components/DsfrFooter/DsfrFooter.types.ts @@ -24,6 +24,7 @@ export type DsfrFooterLinkProps = { onClick?: ($event: MouseEvent) => void to?: RouteLocationRaw href?: string + title?: string } export type DsfrFooterLinkListProps = { @@ -44,15 +45,15 @@ export type DsfrFooterProps = { descText?: string beforeMandatoryLinks?: DsfrFooterLinkProps[] afterMandatoryLinks?: DsfrFooterLinkProps[] - mandatoryLinks?: { label: string, to: RouteLocationRaw | undefined }[] - ecosystemLinks?: { label: string, href: string }[] + mandatoryLinks?: { label: string, to: RouteLocationRaw | undefined, title?: string }[] + ecosystemLinks?: { label: string, href: string, title: string, [key: string]: string }[] operatorLinkText?: string operatorTo?: RouteLocationRaw | undefined operatorImgStyle?: StyleValue operatorImgSrc?: string operatorImgAlt?: string licenceTo?: string - licenceLinkProps?: { href: string } | { to: RouteLocationRaw | undefined } + licenceLinkProps?: ({ href: string } | { to: RouteLocationRaw | undefined }) & Record licenceText?: string licenceName?: string } diff --git a/src/components/DsfrFooter/DsfrFooter.vue b/src/components/DsfrFooter/DsfrFooter.vue index 60d8f54c..5abefd1b 100644 --- a/src/components/DsfrFooter/DsfrFooter.vue +++ b/src/components/DsfrFooter/DsfrFooter.vue @@ -53,18 +53,22 @@ const props = withDefaults(defineProps(), { { label: 'info.gouv.fr', href: 'https://info.gouv.fr', + title: 'Informations gouvernementales, nouvelle fenêtre', }, { label: 'service-public.fr', href: 'https://service-public.fr', + title: 'Informations et démarches administratives, nouvelle fenêtre', }, { label: 'legifrance.gouv.fr', href: 'https://legifrance.gouv.fr', + title: 'Service public de diffusion du droit, nouvelle fenêtre', }, { label: 'data.gouv.fr', href: 'https://data.gouv.fr', + title: 'Plateforme des données publiques, nouvelle fenêtre', }, ], operatorLinkText: 'Revenir à l’accueil', @@ -95,6 +99,12 @@ const isExternalLink = computed(() => { const to = props.licenceTo || (props.licenceLinkProps as { to: RouteLocationRaw }).to return to && typeof to === 'string' && to.startsWith('http') }) + +const licenceLinkAttrs = computed(() => { + const { to, href, ...attrs } = props.licenceLinkProps ?? {} + return attrs +}) + const routerLinkLicenceTo = computed(() => { return isExternalLink.value ? '' : props.licenceTo }) @@ -184,17 +194,19 @@ const externalOperatorLink = computed(() => {

@@ -225,11 +237,11 @@ const externalOperatorLink = computed(() => { {{ licenceName }} From 712a2593cc99d11eccfa1acf8016c033fafabc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanislas=20Ormi=C3=A8res?= Date: Sun, 15 Sep 2024 13:11:09 +0200 Subject: [PATCH 2/5] =?UTF-8?q?fix(DsfrHeader):=20lien=20homeTo=20m=C3=AAm?= =?UTF-8?q?e=20sans=20serviceTitle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #889 --- src/components/DsfrHeader/DsfrHeader.stories.ts | 3 ++- src/components/DsfrHeader/DsfrHeader.vue | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/DsfrHeader/DsfrHeader.stories.ts b/src/components/DsfrHeader/DsfrHeader.stories.ts index 5d22c3a5..289ac115 100644 --- a/src/components/DsfrHeader/DsfrHeader.stories.ts +++ b/src/components/DsfrHeader/DsfrHeader.stories.ts @@ -186,9 +186,10 @@ EnTeteSimple.args = { EnTeteSimple.play = async ({ canvasElement }) => { const canvas = within(canvasElement) const links = canvas.getAllByRole('link') - expect(links).toHaveLength(4) + expect(links).toHaveLength(5) const knownLinks = [ + { name: '', href: EnTeteSimple.args.homeTo }, { name: '', href: EnTeteSimple.args.homeTo }, ...EnTeteSimple.args.quickLinks.map(({ to }) => ({ href: to })), ] diff --git a/src/components/DsfrHeader/DsfrHeader.vue b/src/components/DsfrHeader/DsfrHeader.vue index 279ad60b..17b5672f 100644 --- a/src/components/DsfrHeader/DsfrHeader.vue +++ b/src/components/DsfrHeader/DsfrHeader.vue @@ -96,10 +96,15 @@ provide(registerNavigationLinkKey, () => {