From fdd263c1c7abb807d66a5075a26a5ad7bc00d042 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Fri, 13 Nov 2026 15:27:47 +0100
Subject: [PATCH 01/33] fix(tags): harmonize compact interactive states
---
assets/css/overrides.css | 114 ++++++++++++++++++
.../SuiviDePublication/HvdStatutBadge.vue | 9 +-
components/TagsSelect.vue | 3 +
pages/datasets/[did].vue | 1 +
tests/datasets/[did].spec.ts | 22 ++++
tests/datasets/creation.spec.ts | 10 ++
.../donnees-de-forte-valeur.spec.ts | 17 +++
7 files changed, 173 insertions(+), 3 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index fb92c7d30..0b9e05acd 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -34,6 +34,120 @@
@apply w-10 leading-0 text-lg;
}
+/*
+ * Compact tags and interaction states owned by cdata.
+ *
+ * DSFR interactive tags are blue at rest by default. In cdata they stay neutral
+ * until hover/focus, while selected and dismissible values keep a stable blue.
+ */
+.fr-tag {
+ font-size: 0.75rem;
+ line-height: 1.25rem;
+ min-height: 1.5rem;
+ padding: 0.125rem 0.5rem;
+ border-radius: 0.75rem;
+}
+
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]) {
+ color: var(--text-label-grey);
+ background-color: var(--background-contrast-grey);
+ --hover: var(--background-action-low-blue-france);
+ --active: var(--background-action-low-blue-france-active);
+}
+
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):focus-visible {
+ color: var(--text-action-high-blue-france);
+ background-color: var(--background-action-low-blue-france);
+ outline: 2px solid var(--border-active-blue-france);
+ outline-offset: 2px;
+}
+
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):is(:hover, :active) {
+ color: var(--text-action-high-blue-france);
+}
+
+:is(button, input[type="button"]).fr-tag:is(.fr-tag--dismiss, [aria-pressed="true"]):not(:disabled) {
+ color: var(--text-inverted-blue-france);
+ background-color: var(--background-action-high-blue-france);
+ --hover: var(--background-action-high-blue-france);
+ --active: var(--background-action-high-blue-france-active);
+}
+
+:is(button, input[type="button"]).fr-tag:is(.fr-tag--dismiss, [aria-pressed="true"]):not(:disabled):focus-visible {
+ outline: 2px solid var(--border-active-blue-france);
+ outline-offset: 2px;
+}
+
+:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled),
+:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled):hover {
+ background-image: radial-gradient(circle at 100% 0.1875rem, transparent 0.4475rem, var(--background-active-blue-france) 0.5rem);
+}
+
+:is(button, input[type="button"]).fr-tag:disabled {
+ color: var(--text-disabled-grey);
+ background-color: var(--background-disabled-grey);
+ --hover: var(--background-disabled-grey);
+ --active: var(--background-disabled-grey);
+}
+
+/*
+ * DatasetLabelTag belongs to @datagouv/components-next. The consumer class keeps
+ * cdata's linked instance neutral at rest and preserves the SVG's native pixels.
+ * `!important` is required because the package ships Tailwind in important mode.
+ */
+.cdata-dataset-label-tag {
+ min-height: 1.5rem;
+ color: var(--text-label-grey) !important;
+ background-color: var(--background-contrast-grey) !important;
+ gap: 0.125rem !important;
+}
+
+a.cdata-dataset-label-tag:hover,
+a.cdata-dataset-label-tag:focus-visible {
+ color: var(--text-action-high-blue-france) !important;
+ background-color: var(--background-action-low-blue-france) !important;
+}
+
+a.cdata-dataset-label-tag:active {
+ background-color: var(--background-action-low-blue-france-active) !important;
+}
+
+a.cdata-dataset-label-tag:focus-visible {
+ outline: 2px solid var(--border-active-blue-france);
+ outline-offset: 2px;
+}
+
+.cdata-dataset-label-tag > img {
+ background-color: transparent !important;
+ border-radius: 0 !important;
+}
+
+/* The business badge keeps its semantic colour; only its label is underlined. */
+.hvd-status-badge-link {
+ display: inline-flex;
+ border-radius: 0.25rem;
+ background-color: transparent !important;
+ --hover-tint: transparent;
+ --active-tint: transparent;
+}
+
+.hvd-status-badge-link:hover,
+.hvd-status-badge-link:active,
+.hvd-status-badge-link:focus-visible {
+ background-color: transparent !important;
+}
+
+.hvd-status-badge-link:hover > span > span {
+ text-decoration-line: underline;
+ text-decoration-thickness: 1px;
+ text-underline-offset: 2px;
+}
+
+.hvd-status-badge-link:focus-visible {
+ outline: 2px solid var(--border-active-blue-france);
+ outline-offset: 2px;
+}
+
/* Breadcrumb placed on a coloured hero background (OnboardingHero, EditoHeader).
Links inherit the container colour and the separator chevrons use currentColor,
so a single white colour covers the whole breadcrumb. The hero owns the
diff --git a/components/SuiviDePublication/HvdStatutBadge.vue b/components/SuiviDePublication/HvdStatutBadge.vue
index be88c1eb2..495146e87 100644
--- a/components/SuiviDePublication/HvdStatutBadge.vue
+++ b/components/SuiviDePublication/HvdStatutBadge.vue
@@ -5,15 +5,16 @@
:to="url"
external
target="_blank"
- rel="noopener"
- class="no-underline fr-raw-link"
+ rel="noopener noreferrer"
+ :aria-label="`${statut} — ${t('Voir les données (nouvel onglet)')}`"
+ class="hvd-status-badge-link no-underline fr-raw-link"
>
{{ statut }}
@@ -34,6 +35,8 @@ import CdataLink from '~/components/CdataLink.vue'
import AdminBadge from '~/components/AdminBadge/AdminBadge.vue'
import type { AdminBadgeType } from '~/types/types'
+const { t } = useTranslation()
+
// Presentation only: the status → colour / links-to-data mapping is owned by the
// hosting page (single source of truth in its STATUTS list) and passed in.
defineProps<{
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 9000d78a6..85beebb96 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -20,11 +20,14 @@
diff --git a/pages/datasets/[did].vue b/pages/datasets/[did].vue
index ec3e2da6d..c64dd4705 100644
--- a/pages/datasets/[did].vue
+++ b/pages/datasets/[did].vue
@@ -307,6 +307,7 @@
:key="badge.kind"
:badge
:url="`/datasets/search?badge=${badge.kind}`"
+ class="cdata-dataset-label-tag"
/>
diff --git a/tests/datasets/[did].spec.ts b/tests/datasets/[did].spec.ts
index a0ea11e65..32f3bf385 100644
--- a/tests/datasets/[did].spec.ts
+++ b/tests/datasets/[did].spec.ts
@@ -27,12 +27,34 @@ test('dataset with labels shows label section', async ({ page }) => {
// Check that labels are clickable links
await expect(labelsList.locator('a')).toHaveCount(1)
+ const label = labelsList.locator('a').first()
+ await expect(label).toHaveCSS('font-size', '12px')
+ await expect(label).toHaveCSS('min-height', '24px')
+ await expect(label.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+
// The label text comes from the badge reference list, which the page only
// fetches for datasets that carry badges: a link with an empty label means
// that list was not loaded.
await expect(labelsList.locator('a')).toHaveText(/Service public de la donnée/)
})
+test('linked dataset labels are neutral at rest and blue on hover and focus', async ({ page }) => {
+ await page.goto(
+ '/datasets/base-sirene-des-entreprises-et-de-leurs-etablissements-siren-siret/',
+ )
+
+ const label = page.getByTestId('label-list').locator('a').first()
+ const restBackground = await label.evaluate(element => getComputedStyle(element).backgroundColor)
+ await label.hover()
+ const hoverBackground = await label.evaluate(element => getComputedStyle(element).backgroundColor)
+ expect(hoverBackground).not.toBe(restBackground)
+
+ await label.focus()
+ await expect(label).toBeFocused()
+ await expect(label).toHaveCSS('outline-style', 'solid')
+ await expect(label).toHaveCSS('outline-width', '2px')
+})
+
test('dataset labels have proper tooltips and information', async ({
page,
}) => {
diff --git a/tests/datasets/creation.spec.ts b/tests/datasets/creation.spec.ts
index d956815cb..7ea0ba918 100644
--- a/tests/datasets/creation.spec.ts
+++ b/tests/datasets/creation.spec.ts
@@ -129,6 +129,16 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
await page.getByPlaceholder('Chercher un mot clé…').fill('toto')
await page.getByRole('option', { name: 'toto' }).click()
await clickOutside(page)
+ const selectedTags = page.getByTestId('selected-tags')
+ await expect(selectedTags.getByRole('button')).toHaveCount(2)
+ await expect(selectedTags.getByRole('button')).toHaveText(['test', 'toto'])
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
+
+ // A selected keyword is also dismissible: removing it must keep the model in sync.
+ await page.getByRole('button', { name: 'Supprimer le mot-clé test' }).click()
+ await expect(selectedTags.getByRole('button')).toHaveCount(1)
+ await expect(selectedTags.getByRole('button')).toHaveText(['toto'])
await page.getByTestId('searchable-select-licence').click()
await page.getByText('Other (Public Domain)').click()
await clickOutside(page)
diff --git a/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts b/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts
index 1d29a420a..a7801ae7a 100644
--- a/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts
+++ b/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts
@@ -116,6 +116,23 @@ test('links the status badges to the published data', async ({ page }) => {
// "Disponible sur data.gouv.fr" links to the dataset url.
const telechargementLink = zebreRow.locator('td').nth(5).getByRole('link')
await expect(telechargementLink).toHaveAttribute('href', 'https://www.data.gouv.fr/datasets/zebre')
+ await expect(telechargementLink).toHaveAttribute('target', '_blank')
+ await expect(telechargementLink).toHaveAttribute('rel', 'noopener noreferrer')
+ await expect(telechargementLink).toHaveAccessibleName('Disponible sur data.gouv.fr — Voir les données (nouvel onglet)')
+ await expect(telechargementLink.locator('svg')).toHaveCount(1)
+ await expect(telechargementLink).not.toContainText('Voir les données')
+
+ const badge = telechargementLink.locator(':scope > span')
+ const badgeLabel = badge.locator(':scope > span')
+ const badgeBackground = await badge.evaluate(element => getComputedStyle(element).backgroundColor)
+ await telechargementLink.hover()
+ await expect(telechargementLink).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+ await expect(badge).toHaveCSS('background-color', badgeBackground)
+ await expect(badgeLabel).toHaveCSS('text-decoration-line', 'underline')
+
+ await telechargementLink.focus()
+ await expect(telechargementLink).toBeFocused()
+ await expect(telechargementLink).toHaveCSS('outline-width', '2px')
// "Non disponible" has no url and is not a link.
await expect(zebreRow.locator('td').nth(6).getByRole('link')).toHaveCount(0)
await expect(zebreRow.locator('td').nth(6)).toContainText('Non disponible')
From 5a24ceea5a8647c2359800390059072d373a918b Mon Sep 17 00:00:00 2001
From: agarrone
Date: Fri, 13 Nov 2026 22:23:23 +0100
Subject: [PATCH 02/33] docs(design): add tags and labels gallery
---
assets/css/overrides.css | 56 +++++---
components/TagsSelect.vue | 7 +-
pages/design.vue | 9 +-
pages/design/cards.vue | 5 +-
pages/design/tags.vue | 192 +++++++++++++++++++++++++++
tests/design-tags.logged-out.spec.ts | 61 +++++++++
6 files changed, 305 insertions(+), 25 deletions(-)
create mode 100644 pages/design/tags.vue
create mode 100644 tests/design-tags.logged-out.spec.ts
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 0b9e05acd..d4702fcf2 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -53,6 +53,8 @@
background-color: var(--background-contrast-grey);
--hover: var(--background-action-low-blue-france);
--active: var(--background-action-low-blue-france-active);
+ --hover-tint: var(--background-action-low-blue-france);
+ --active-tint: var(--background-action-low-blue-france-active);
}
:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):focus-visible {
@@ -66,11 +68,21 @@
color: var(--text-action-high-blue-france);
}
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):hover {
+ background-color: var(--background-action-low-blue-france) !important;
+}
+
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):active {
+ background-color: var(--background-action-low-blue-france-active) !important;
+}
+
:is(button, input[type="button"]).fr-tag:is(.fr-tag--dismiss, [aria-pressed="true"]):not(:disabled) {
color: var(--text-inverted-blue-france);
background-color: var(--background-action-high-blue-france);
--hover: var(--background-action-high-blue-france);
--active: var(--background-action-high-blue-france-active);
+ --hover-tint: var(--background-action-high-blue-france);
+ --active-tint: var(--background-action-high-blue-france-active);
}
:is(button, input[type="button"]).fr-tag:is(.fr-tag--dismiss, [aria-pressed="true"]):not(:disabled):focus-visible {
@@ -88,6 +100,8 @@
background-color: var(--background-disabled-grey);
--hover: var(--background-disabled-grey);
--active: var(--background-disabled-grey);
+ --hover-tint: var(--background-disabled-grey);
+ --active-tint: var(--background-disabled-grey);
}
/*
@@ -95,21 +109,28 @@
* cdata's linked instance neutral at rest and preserves the SVG's native pixels.
* `!important` is required because the package ships Tailwind in important mode.
*/
-.cdata-dataset-label-tag {
- min-height: 1.5rem;
- color: var(--text-label-grey) !important;
- background-color: var(--background-contrast-grey) !important;
- gap: 0.125rem !important;
-}
-
-a.cdata-dataset-label-tag:hover,
-a.cdata-dataset-label-tag:focus-visible {
- color: var(--text-action-high-blue-france) !important;
- background-color: var(--background-action-low-blue-france) !important;
-}
-
-a.cdata-dataset-label-tag:active {
- background-color: var(--background-action-low-blue-france-active) !important;
+@layer utilities {
+ .cdata-dataset-label-tag {
+ min-height: 1.5rem;
+ color: var(--text-label-grey) !important;
+ background-color: var(--background-contrast-grey) !important;
+ gap: 0.125rem !important;
+ }
+
+ a.cdata-dataset-label-tag:hover,
+ a.cdata-dataset-label-tag:focus-visible {
+ color: var(--text-action-high-blue-france) !important;
+ background-color: var(--background-action-low-blue-france) !important;
+ }
+
+ a.cdata-dataset-label-tag:active {
+ background-color: var(--background-action-low-blue-france-active) !important;
+ }
+
+ .datagouv-components .cdata-dataset-label-tag > img.bg-white {
+ background-color: transparent !important;
+ border-radius: 0 !important;
+ }
}
a.cdata-dataset-label-tag:focus-visible {
@@ -117,11 +138,6 @@ a.cdata-dataset-label-tag:focus-visible {
outline-offset: 2px;
}
-.cdata-dataset-label-tag > img {
- background-color: transparent !important;
- border-radius: 0 !important;
-}
-
/* The business badge keeps its semantic colour; only its label is underlined. */
.hvd-status-badge-link {
display: inline-flex;
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 85beebb96..6d1c54700 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -6,7 +6,7 @@
:placeholder="t('Chercher un mot clé…')"
:get-option-id="(tag: Tag) => tag.text"
:allow-new-option="toTag"
- :suggest="suggestTags"
+ :suggest
:multiple="true"
class="!mb-0"
@@ -41,9 +41,10 @@
import { SearchableSelect } from '@datagouv/components-next'
import type { Tag } from '~/types/types'
-defineProps<{
+const props = defineProps<{
errorText?: string | null
warningText?: string | null
+ suggest?: (query: string) => Promise>
}>()
const tags = defineModel>({ required: true })
@@ -58,6 +59,8 @@ async function suggestTags(query: string) {
},
})
}
+
+const suggest = computed(() => props.suggest ?? suggestTags)
function removeTag(tag: Tag) {
tags.value = tags.value.filter(otherTag => otherTag.text !== tag.text)
}
diff --git a/pages/design.vue b/pages/design.vue
index 8078eddb4..f3f4a4e15 100644
--- a/pages/design.vue
+++ b/pages/design.vue
@@ -28,6 +28,11 @@
:label="$t('Boutons')"
to="/design/buttons"
/>
+
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
new file mode 100644
index 000000000..3fc4b1a86
--- /dev/null
+++ b/tests/design-tags.logged-out.spec.ts
@@ -0,0 +1,61 @@
+import { expect, test } from './base'
+import { gotoHydrated } from './helpers'
+
+test.beforeEach(async ({ page }) => {
+ await gotoHydrated(page, '/design/tags')
+})
+
+test('shows every compact tag state', async ({ page }) => {
+ const staticTag = page.getByTestId('static-tag')
+ const clickableTag = page.getByTestId('clickable-tag')
+ const selectableTag = page.getByTestId('selectable-tag')
+ const disabledTag = page.getByTestId('disabled-tag')
+
+ for (const tag of [staticTag, clickableTag, selectableTag, disabledTag]) {
+ await expect(tag).toHaveCSS('font-size', '12px')
+ await expect(tag).toHaveCSS('min-height', '24px')
+ }
+
+ const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
+ await clickableTag.hover()
+ await expect(clickableTag).not.toHaveCSS('background-color', restBackground)
+ await clickableTag.focus()
+ await expect(clickableTag).toHaveCSS('outline-style', 'solid')
+
+ await selectableTag.click()
+ await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
+ const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
+ await selectableTag.hover()
+ await expect(selectableTag).toHaveCSS('background-color', selectedBackground)
+
+ const disabledBackground = await disabledTag.evaluate(element => getComputedStyle(element).backgroundColor)
+ await disabledTag.hover()
+ await expect(disabledTag).toHaveCSS('background-color', disabledBackground)
+})
+
+test('shows and removes multiple TagsSelect values', async ({ page }) => {
+ const selectedTags = page.getByTestId('selected-tags')
+ await expect(selectedTags.getByRole('button')).toHaveCount(3)
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
+
+ await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
+ await expect(selectedTags.getByRole('button')).toHaveCount(2)
+ await expect(selectedTags).not.toContainText('transport')
+})
+
+test('shows DatasetLabelTag with and without a link', async ({ page }) => {
+ const staticLabel = page.getByTestId('dataset-label-static')
+ const linkedLabel = page.getByTestId('dataset-label-link')
+
+ await expect(staticLabel).not.toHaveAttribute('href')
+ await expect(linkedLabel).toHaveAttribute('href', '#dataset-label-examples')
+ await expect(linkedLabel).toHaveCSS('min-height', '24px')
+ await expect(linkedLabel.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+
+ const restBackground = await linkedLabel.evaluate(element => getComputedStyle(element).backgroundColor)
+ await linkedLabel.hover()
+ await expect(linkedLabel).not.toHaveCSS('background-color', restBackground)
+ await linkedLabel.focus()
+ await expect(linkedLabel).toHaveCSS('outline-style', 'solid')
+})
From ca8d74b3e6d59b6f56c2ebd9d50460ce8a40df64 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Fri, 13 Nov 2026 22:42:57 +0100
Subject: [PATCH 03/33] fix(design): align tags and badges with design lab
---
assets/css/overrides.css | 49 +++++--
components/AdminBadge/AdminBadge.vue | 46 +++++--
.../SuiviDePublication/HvdStatutBadge.vue | 1 -
components/TagsSelect.vue | 10 +-
pages/design/tags.vue | 126 ++++++++++++++----
tests/design-tags.logged-out.spec.ts | 34 ++++-
6 files changed, 215 insertions(+), 51 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index d4702fcf2..3ea99387f 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -37,18 +37,25 @@
/*
* Compact tags and interaction states owned by cdata.
*
- * DSFR interactive tags are blue at rest by default. In cdata they stay neutral
- * until hover/focus, while selected and dismissible values keep a stable blue.
+ * Consumer implementation of the Component Design Lab proposal. Static tags
+ * stay neutral; interactive tags use DSFR action colours and selected filters
+ * keep the high blue state.
*/
.fr-tag {
+ box-sizing: border-box;
+ gap: 0.25rem;
font-size: 0.75rem;
- line-height: 1.25rem;
+ font-weight: 400;
+ line-height: 1.125rem;
min-height: 1.5rem;
padding: 0.125rem 0.5rem;
+ border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
border-radius: 0.75rem;
+ color: var(--text-label-grey);
+ background-color: var(--background-contrast-grey);
}
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]) {
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]) {
color: var(--text-label-grey);
background-color: var(--background-contrast-grey);
--hover: var(--background-action-low-blue-france);
@@ -57,26 +64,26 @@
--active-tint: var(--background-action-low-blue-france-active);
}
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):focus-visible {
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):focus-visible {
color: var(--text-action-high-blue-france);
background-color: var(--background-action-low-blue-france);
outline: 2px solid var(--border-active-blue-france);
outline-offset: 2px;
}
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):is(:hover, :active) {
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):is(:hover, :active) {
color: var(--text-action-high-blue-france);
}
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):hover {
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):hover {
background-color: var(--background-action-low-blue-france) !important;
}
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not(.fr-tag--dismiss, [aria-pressed="true"]):active {
+:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):active {
background-color: var(--background-action-low-blue-france-active) !important;
}
-:is(button, input[type="button"]).fr-tag:is(.fr-tag--dismiss, [aria-pressed="true"]):not(:disabled) {
+:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled) {
color: var(--text-inverted-blue-france);
background-color: var(--background-action-high-blue-france);
--hover: var(--background-action-high-blue-france);
@@ -85,7 +92,7 @@
--active-tint: var(--background-action-high-blue-france-active);
}
-:is(button, input[type="button"]).fr-tag:is(.fr-tag--dismiss, [aria-pressed="true"]):not(:disabled):focus-visible {
+:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled):focus-visible {
outline: 2px solid var(--border-active-blue-france);
outline-offset: 2px;
}
@@ -111,10 +118,18 @@
*/
@layer utilities {
.cdata-dataset-label-tag {
+ box-sizing: border-box;
min-height: 1.5rem;
+ padding: 0.125rem 0.5rem !important;
+ border: 1px solid color-mix(in srgb, currentColor 20%, transparent) !important;
+ border-radius: 999px !important;
+ font-size: 0.75rem !important;
+ font-weight: 400 !important;
+ line-height: 1.125rem !important;
+ text-transform: none !important;
color: var(--text-label-grey) !important;
background-color: var(--background-contrast-grey) !important;
- gap: 0.125rem !important;
+ gap: 0.25rem !important;
}
a.cdata-dataset-label-tag:hover,
@@ -127,6 +142,13 @@
background-color: var(--background-action-low-blue-france-active) !important;
}
+ .datagouv-components .cdata-dataset-label-tag > img {
+ width: 0.875rem;
+ height: 0.875rem;
+ object-fit: contain;
+ flex-shrink: 0;
+ }
+
.datagouv-components .cdata-dataset-label-tag > img.bg-white {
background-color: transparent !important;
border-radius: 0 !important;
@@ -143,10 +165,15 @@ a.cdata-dataset-label-tag:focus-visible {
display: inline-flex;
border-radius: 0.25rem;
background-color: transparent !important;
+ background-image: none !important;
--hover-tint: transparent;
--active-tint: transparent;
}
+.hvd-status-badge-link::after {
+ content: none !important;
+}
+
.hvd-status-badge-link:hover,
.hvd-status-badge-link:active,
.hvd-status-badge-link:focus-visible {
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
index 070672443..22c775a3b 100644
--- a/components/AdminBadge/AdminBadge.vue
+++ b/components/AdminBadge/AdminBadge.vue
@@ -1,12 +1,16 @@
@@ -14,7 +18,10 @@
@@ -48,12 +55,31 @@ const colors = computed(() => {
}[props.type]
})
-const sizes = computed(() => {
- return {
- xs: 'text-xs/5 px-1 rounded-sm',
- sm: 'text-xs/6 px-2 rounded',
- }[props.size]
-})
-
-const iconSize = computed(() => props.iconSize || 'size-3')
+const iconSize = computed(() => props.iconSize || 'size-3.5')
+
+
diff --git a/components/SuiviDePublication/HvdStatutBadge.vue b/components/SuiviDePublication/HvdStatutBadge.vue
index 495146e87..36bc5d671 100644
--- a/components/SuiviDePublication/HvdStatutBadge.vue
+++ b/components/SuiviDePublication/HvdStatutBadge.vue
@@ -14,7 +14,6 @@
:icon-right="RiExternalLinkLine"
size="sm"
:no-wrap="false"
- icon-size="size-3"
>
{{ statut }}
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 6d1c54700..de3babfba 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -19,19 +19,24 @@
{{ tag.text }}
+
@@ -39,6 +44,7 @@
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 3fc4b1a86..09e30756c 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -13,7 +13,9 @@ test('shows every compact tag state', async ({ page }) => {
for (const tag of [staticTag, clickableTag, selectableTag, disabledTag]) {
await expect(tag).toHaveCSS('font-size', '12px')
+ await expect(tag).toHaveCSS('line-height', '18px')
await expect(tag).toHaveCSS('min-height', '24px')
+ await expect(tag).toHaveCSS('border-top-width', '1px')
}
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -31,13 +33,20 @@ test('shows every compact tag state', async ({ page }) => {
const disabledBackground = await disabledTag.evaluate(element => getComputedStyle(element).backgroundColor)
await disabledTag.hover()
await expect(disabledTag).toHaveCSS('background-color', disabledBackground)
+
+ const dismissibleTag = page.getByTestId('dismissible-tag')
+ const dismissibleBackground = await dismissibleTag.evaluate(element => getComputedStyle(element).backgroundColor)
+ await dismissibleTag.hover()
+ await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
})
test('shows and removes multiple TagsSelect values', async ({ page }) => {
const selectedTags = page.getByTestId('selected-tags')
await expect(selectedTags.getByRole('button')).toHaveCount(3)
await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '18px')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
@@ -49,8 +58,10 @@ test('shows DatasetLabelTag with and without a link', async ({ page }) => {
const linkedLabel = page.getByTestId('dataset-label-link')
await expect(staticLabel).not.toHaveAttribute('href')
- await expect(linkedLabel).toHaveAttribute('href', '#dataset-label-examples')
+ await expect(linkedLabel).toHaveAttribute('href', '/datasets/search?badge=hvd')
+ await expect(staticLabel).toHaveCSS('line-height', '18px')
await expect(linkedLabel).toHaveCSS('min-height', '24px')
+ await expect(linkedLabel.locator('img')).toHaveCSS('width', '14px')
await expect(linkedLabel.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
const restBackground = await linkedLabel.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -59,3 +70,24 @@ test('shows DatasetLabelTag with and without a link', async ({ page }) => {
await linkedLabel.focus()
await expect(linkedLabel).toHaveCSS('outline-style', 'solid')
})
+
+test('shows HvdStatutBadge with and without a data URL', async ({ page }) => {
+ await expect(page.getByTestId('hvd-status-empty').getByText('-', { exact: true })).toBeVisible()
+
+ const staticBadge = page.getByTestId('hvd-status-static').locator('.admin-badge')
+ await expect(staticBadge).toHaveCSS('text-transform', 'none')
+
+ const linkedBadge = page.getByTestId('hvd-status-link').locator('a')
+ await expect(linkedBadge).toHaveAttribute('target', '_blank')
+ await expect(linkedBadge).toHaveAttribute('rel', 'noopener noreferrer')
+ await expect(linkedBadge).toHaveAttribute('aria-label', /Publié.*Voir les données.*nouvel onglet/)
+ await expect(linkedBadge.locator('svg')).toHaveCount(1)
+ await expect(linkedBadge.locator('svg')).toHaveCSS('width', '14px')
+
+ const badgeBackground = await linkedBadge.locator('.admin-badge').evaluate(element => getComputedStyle(element).backgroundColor)
+ await linkedBadge.hover()
+ await expect(linkedBadge.locator('.admin-badge')).toHaveCSS('background-color', badgeBackground)
+ await expect(linkedBadge.locator('.admin-badge > span')).toHaveCSS('text-decoration-line', 'underline')
+ await linkedBadge.focus()
+ await expect(linkedBadge).toHaveCSS('outline-style', 'solid')
+})
From d99420b58206c73dfe8f097b39cd0df30f3b87f8 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sat, 14 Nov 2026 08:54:36 +0100
Subject: [PATCH 04/33] fix(tags): keep a visible stroke on metadata tags
---
assets/css/overrides.css | 34 +++++++++++++++++++++++++--
pages/datasets/[did]/informations.vue | 5 +++-
pages/design/tags.vue | 16 ++++++++++---
tests/design-tags.logged-out.spec.ts | 18 ++++++++++++++
4 files changed, 67 insertions(+), 6 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 3ea99387f..bb68cb93e 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -49,12 +49,42 @@
line-height: 1.125rem;
min-height: 1.5rem;
padding: 0.125rem 0.5rem;
- border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
+ border: 1px solid var(--border-default-grey);
border-radius: 0.75rem;
color: var(--text-label-grey);
background-color: var(--background-contrast-grey);
}
+/*
+ * @datagouv/components-next Tag does not expose a bordered variant yet.
+ * cdata adds the Design Lab stroke to its direct examples and to the tags
+ * rendered by DatasetInformationSection without changing the shared package.
+ */
+@layer utilities {
+ .cdata-tag,
+ .cdata-dataset-information .fr-raw-link > span {
+ box-sizing: border-box;
+ min-height: 1.5rem;
+ border: 1px solid var(--border-default-grey) !important;
+ }
+
+ .cdata-tag-link:hover > .cdata-tag,
+ .cdata-tag-link:focus-visible > .cdata-tag,
+ .cdata-dataset-information .fr-raw-link:hover > span,
+ .cdata-dataset-information .fr-raw-link:focus-visible > span {
+ color: var(--text-action-high-blue-france) !important;
+ border-color: var(--border-action-high-blue-france) !important;
+ background-color: var(--background-action-low-blue-france) !important;
+ }
+}
+
+.cdata-tag-link:focus-visible,
+.cdata-dataset-information .fr-raw-link:focus-visible {
+ border-radius: 0.75rem;
+ outline: 2px solid var(--border-active-blue-france);
+ outline-offset: 2px;
+}
+
:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]) {
color: var(--text-label-grey);
background-color: var(--background-contrast-grey);
@@ -121,7 +151,7 @@
box-sizing: border-box;
min-height: 1.5rem;
padding: 0.125rem 0.5rem !important;
- border: 1px solid color-mix(in srgb, currentColor 20%, transparent) !important;
+ border: 1px solid var(--border-default-grey) !important;
border-radius: 999px !important;
font-size: 0.75rem !important;
font-weight: 400 !important;
diff --git a/pages/datasets/[did]/informations.vue b/pages/datasets/[did]/informations.vue
index e17b2d61e..414bbc5e2 100644
--- a/pages/datasets/[did]/informations.vue
+++ b/pages/datasets/[did]/informations.vue
@@ -1,6 +1,9 @@
-
+
{{ $t('DOI') }}
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index d99eb381c..6d2e33e62 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -25,20 +25,30 @@
Le composant est possédé par @datagouv/components-next. Ces exemples montrent son rendu actuel côté consommateur ; son API interactive devra être portée dans ce dépôt partagé.
-
+
Mobilité
Données ouvertes
-
+
Environnement
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 09e30756c..04ec81f7b 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -40,6 +40,24 @@ test('shows every compact tag state', async ({ page }) => {
await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
})
+test('shows component tags with a stroke, including the linked variant', async ({ page }) => {
+ const staticTag = page.getByTestId('components-tag-static')
+ const iconTag = page.getByTestId('components-tag-icon')
+ const linkedTag = page.getByTestId('components-tag-link')
+
+ for (const tag of [staticTag, iconTag, linkedTag]) {
+ await expect(tag).toHaveCSS('border-top-width', '1px')
+ await expect(tag).toHaveCSS('min-height', '24px')
+ }
+
+ const link = linkedTag.locator('..')
+ const restBackground = await linkedTag.evaluate(element => getComputedStyle(element).backgroundColor)
+ await link.hover()
+ await expect(linkedTag).not.toHaveCSS('background-color', restBackground)
+ await link.focus()
+ await expect(link).toHaveCSS('outline-style', 'solid')
+})
+
test('shows and removes multiple TagsSelect values', async ({ page }) => {
const selectedTags = page.getByTestId('selected-tags')
await expect(selectedTags.getByRole('button')).toHaveCount(3)
From 9fc97b716c6ff685f9a2ac18d39a1c3a9aa8cd52 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sat, 14 Nov 2026 09:01:21 +0100
Subject: [PATCH 05/33] fix(design): compare card labels and simplify tag
examples
---
assets/css/overrides.css | 7 ++-
pages/design/tags.vue | 83 +++++++++++++++++++---------
tests/design-tags.logged-out.spec.ts | 14 +++++
3 files changed, 76 insertions(+), 28 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index bb68cb93e..23b704d50 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -129,7 +129,12 @@
:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled),
:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled):hover {
- background-image: radial-gradient(circle at 100% 0.1875rem, transparent 0.4475rem, var(--background-active-blue-france) 0.5rem);
+ background-color: var(--background-action-high-blue-france) !important;
+ background-image: none !important;
+}
+
+:is(button, input[type="button"]).fr-tag[aria-pressed="true"]::after {
+ content: none !important;
}
:is(button, input[type="button"]).fr-tag:disabled {
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index 6d2e33e62..6648fbb47 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -12,18 +12,12 @@
Tags et labels
-
- Reprise des variantes proposées dans le Component Design Lab. Les exemples sont autonomes afin de vérifier les états sans backend local.
-
-
+
- Tag — proposition du Design Lab
+ Tags
-
- Le composant est possédé par @datagouv/components-next. Ces exemples montrent son rendu actuel côté consommateur ; son API interactive devra être portée dans ce dépôt partagé.
-
- Variantes et états interactifs
+ États interactifs
-
- Géométrie et états de la proposition Tag : 12/18, icônes 14 px, pilule neutre et couleurs d’action DSFR.
-
-
- Survolez les tags et utilisez la touche Tab pour vérifier le hover et le focus clavier.
-
TagsSelect
-
- Plusieurs valeurs sélectionnées avec la géométrie du Design Lab et suppression fonctionnelle.
-
- DatasetLabelTag — proposition du Design Lab
+ Labels de données
-
- La variante statique reste informative ; la variante liée adopte les états du tag interactif. L’illustration est contenue dans 14 px, sans pastille blanche.
-
+
+
+ Labels métier des cartes
+
+
+
+
+ Brouillon
+
+
+
+ Archivé
+
+
+
+ Accès restreint
+
+
+
+ Ouvert avec un compte
+
+
+
+ Supprimé
+
+
+
+ Service public
+
+
+
+
- HvdStatutBadge — proposition du Design Lab
+ Statuts HVD
-
- Le statut conserve sa couleur métier. Avec une URL, toute la pastille est cliquable, l’icône externe n’apparaît qu’une fois et seul le libellé se souligne au survol.
-
import { LabelTag, Tag, type TranslatedBadge } from '@datagouv/components-next'
-import { RiCheckLine, RiCheckboxCircleLine, RiCloseLine, RiInformationLine } from '@remixicon/vue'
+import { RiArchiveLine, RiCheckboxCircleLine, RiCheckLine, RiCloseLine, RiDeleteBinLine, RiGovernmentLine, RiInformationLine, RiLockLine, RiPassValidLine } from '@remixicon/vue'
import BreadcrumbItem from '~/components/Breadcrumbs/BreadcrumbItem.vue'
import HvdStatutBadge from '~/components/SuiviDePublication/HvdStatutBadge.vue'
import TagsSelect from '~/components/TagsSelect.vue'
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 04ec81f7b..3da989fe6 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -26,6 +26,9 @@ test('shows every compact tag state', async ({ page }) => {
await selectableTag.click()
await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
+ await expect(selectableTag.locator('svg')).toHaveCount(1)
+ await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
+ expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await selectableTag.hover()
await expect(selectableTag).toHaveCSS('background-color', selectedBackground)
@@ -40,6 +43,17 @@ test('shows every compact tag state', async ({ page }) => {
await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
})
+test('shows the business labels used by cards', async ({ page }) => {
+ const labels = page.getByTestId('card-business-labels')
+
+ for (const text of ['Brouillon', 'Archivé', 'Accès restreint', 'Ouvert avec un compte', 'Supprimé', 'Service public']) {
+ await expect(labels.getByText(text, { exact: true })).toBeVisible()
+ }
+
+ await expect(labels.locator('span').first()).toHaveCSS('min-height', '24px')
+ await expect(labels.locator('svg').first()).toHaveCSS('width', '14px')
+})
+
test('shows component tags with a stroke, including the linked variant', async ({ page }) => {
const staticTag = page.getByTestId('components-tag-static')
const iconTag = page.getByTestId('components-tag-icon')
From 11349eb2c2f83051910f068bd54f5c816b3284dc Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sat, 14 Nov 2026 14:05:24 +0100
Subject: [PATCH 06/33] feat(design): show table status badges
---
pages/design/tags.vue | 48 +++++++++++++++++++++++++++-
tests/design-tags.logged-out.spec.ts | 10 ++++++
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index 6648fbb47..cecaf3baa 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -214,6 +214,28 @@
+
+
+ Statuts des tableaux
+
+
+
+
+ {{ status.label }}
+
+
+
+
+
Statuts HVD
@@ -270,10 +292,11 @@
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index cf95e225f..8bb2a2bb8 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -86,12 +86,16 @@ test('shows API access types with the account-only yellow tone', async ({ page }
test('shows the statuses used in tables', async ({ page }) => {
const statuses = page.getByTestId('table-statuses')
- for (const text of ['Public', 'Brouillon', 'Archivé', 'Supprimé', 'En attente', 'En traitement', 'Terminé', 'Terminé avec des erreurs', 'Échoué', 'Disponible', 'Indisponible', 'Pas encore contrôlé', 'Nouveau', 'Répondu', 'Clos']) {
+ for (const context of ['Publication des objets', 'Traitements', 'Disponibilité des ressources principales', 'Disponibilité des ressources communautaires', 'Discussions']) {
+ await expect(statuses.getByText(context, { exact: true })).toBeVisible()
+ }
+
+ for (const text of ['Public', 'Brouillon', 'Archivé', 'Supprimé', 'En attente', 'En traitement', 'Terminé', 'Terminé avec des erreurs', 'Échoué', 'Inconnu', 'Pas encore contrôlé', 'Nouveau', 'Répondu', 'Clos']) {
await expect(statuses.getByText(text, { exact: true })).toBeVisible()
}
const badges = statuses.locator('.admin-badge')
- await expect(badges).toHaveCount(15)
+ await expect(badges).toHaveCount(18)
await expect(badges.first()).toHaveCSS('min-height', '20px')
await expect(badges.first()).toHaveCSS('line-height', '16px')
await expect(badges.first()).toHaveCSS('padding-top', '1px')
@@ -99,6 +103,14 @@ test('shows the statuses used in tables', async ({ page }) => {
await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
})
+test('shows resource license, schema and format metadata', async ({ page }) => {
+ const metadata = page.getByTestId('resource-metadata-badges')
+
+ await expect(metadata.getByText('Licence Ouverte 2.0', { exact: true })).toBeVisible()
+ await expect(metadata.getByText('etalab/schema-irve', { exact: true })).toBeVisible()
+ await expect(metadata.getByText('CSV', { exact: true })).toBeVisible()
+})
+
test('shows component tags with a stroke, including the linked variant', async ({ page }) => {
const staticTag = page.getByTestId('components-tag-static')
const iconTag = page.getByTestId('components-tag-icon')
From ed02ddc8d417354844a7985eab546e1de32ccae4 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sat, 14 Nov 2026 14:49:36 +0100
Subject: [PATCH 12/33] fix(access): align badges with card labels
---
components/AccessTypes/AccessTypeBadge.vue | 34 +++++++++++++---------
tests/design-tags.logged-out.spec.ts | 16 ++++++----
2 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/components/AccessTypes/AccessTypeBadge.vue b/components/AccessTypes/AccessTypeBadge.vue
index cd2d3ed5e..07dbf3f55 100644
--- a/components/AccessTypes/AccessTypeBadge.vue
+++ b/components/AccessTypes/AccessTypeBadge.vue
@@ -1,33 +1,39 @@
- {{ label }}
+ {{ display.label }}
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 8bb2a2bb8..0f020486d 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -65,7 +65,7 @@ test('shows the business labels used by cards', async ({ page }) => {
}
const accountCardBadge = cardBadges.filter({ hasText: 'Ouvert avec un compte' })
- const accountAccessBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec compte' })
+ const accountAccessBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec un compte' })
await expect(accountCardBadge).toHaveCSS('color', await accountAccessBadge.evaluate(element => getComputedStyle(element).color))
await expect(accountCardBadge).toHaveCSS('background-color', await accountAccessBadge.evaluate(element => getComputedStyle(element).backgroundColor))
})
@@ -74,12 +74,18 @@ test('shows API access types with the account-only yellow tone', async ({ page }
const accessTypes = page.getByTestId('access-type-badges')
await expect(accessTypes.getByText('Ouvert', { exact: true })).toBeVisible()
- await expect(accessTypes.getByText('Ouvert avec compte', { exact: true })).toBeVisible()
- await expect(accessTypes.getByText('Restreint', { exact: true })).toBeVisible()
+ await expect(accessTypes.getByText('Ouvert avec un compte', { exact: true })).toBeVisible()
+ await expect(accessTypes.getByText('Accès restreint', { exact: true })).toBeVisible()
await expect(accessTypes.locator('.admin-badge')).toHaveCount(3)
- const accountBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec compte' })
- const restrictedBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Restreint' })
+ const openBadge = accessTypes.locator('.admin-badge').filter({ hasText: /^Ouvert$/ })
+ const accountBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec un compte' })
+ const restrictedBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Accès restreint' })
+ await expect(openBadge.locator('svg')).toHaveCount(0)
+ await expect(accountBadge.locator('svg')).toHaveCount(1)
+ await expect(restrictedBadge.locator('svg')).toHaveCount(1)
+ await expect(accountBadge.locator('svg')).toHaveCSS('width', '14px')
+ await expect(restrictedBadge.locator('svg')).toHaveCSS('width', '14px')
await expect(accountBadge).not.toHaveCSS('background-color', await restrictedBadge.evaluate(element => getComputedStyle(element).backgroundColor))
})
From 73271a8b82e7c025181b215adc0cdf276c35cc0f Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sat, 14 Nov 2026 14:56:16 +0100
Subject: [PATCH 13/33] docs(design): refine tag gallery examples
---
pages/design/tags.vue | 86 ++++++++++++++--------------
tests/design-tags.logged-out.spec.ts | 31 ++++++++--
2 files changed, 68 insertions(+), 49 deletions(-)
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index affd27a7f..f2022996f 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -76,6 +76,42 @@
>
Cliquable · bouton
+
+ Avec infobulle
+
+
+
+
+ Informations du tag
+
+
+ ×
+
+
+
+ Ce tag apporte une information complémentaire au clic.
+
+
+
-
+
- Métadonnées de ressources
+ Schéma de données
-
-
-
-
- Schéma
-
-
etalab/schema-irve
-
-
-
- Format
-
-
-
- CSV
-
-
-
+ etalab/schema-irve
@@ -305,8 +316,8 @@
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 0f020486d..ad57ae6f3 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -43,6 +43,25 @@ test('shows every compact tag state', async ({ page }) => {
await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
})
+test('opens and closes a tag toggletip', async ({ page }) => {
+ const tag = page.getByTestId('toggletip-tag')
+ const content = page.getByTestId('toggletip-tag-content')
+
+ await expect(tag).toHaveCSS('font-size', '12px')
+ await expect(tag).toHaveCSS('min-height', '24px')
+ await expect(tag.locator('svg')).toHaveCount(1)
+ await tag.focus()
+ await expect(tag).toHaveCSS('outline-style', 'solid')
+
+ await tag.click()
+ await expect(tag).toHaveAttribute('aria-expanded', 'true')
+ await expect(content).toBeVisible()
+
+ await page.getByTestId('toggletip-tag-close').click()
+ await expect(tag).toHaveAttribute('aria-expanded', 'false')
+ await expect(content).toBeHidden()
+})
+
test('shows the business labels used by cards', async ({ page }) => {
const labels = page.getByTestId('card-business-labels')
const statuses = page.getByTestId('table-statuses')
@@ -68,6 +87,10 @@ test('shows the business labels used by cards', async ({ page }) => {
const accountAccessBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec un compte' })
await expect(accountCardBadge).toHaveCSS('color', await accountAccessBadge.evaluate(element => getComputedStyle(element).color))
await expect(accountCardBadge).toHaveCSS('background-color', await accountAccessBadge.evaluate(element => getComputedStyle(element).backgroundColor))
+
+ const draftIcon = cardBadges.filter({ hasText: 'Brouillon' }).locator('svg')
+ const restrictedIcon = cardBadges.filter({ hasText: 'Accès restreint' }).locator('svg')
+ expect(await draftIcon.innerHTML()).not.toBe(await restrictedIcon.innerHTML())
})
test('shows API access types with the account-only yellow tone', async ({ page }) => {
@@ -109,12 +132,10 @@ test('shows the statuses used in tables', async ({ page }) => {
await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
})
-test('shows resource license, schema and format metadata', async ({ page }) => {
- const metadata = page.getByTestId('resource-metadata-badges')
+test('shows the data schema badge', async ({ page }) => {
+ const schema = page.getByTestId('schema-badge')
- await expect(metadata.getByText('Licence Ouverte 2.0', { exact: true })).toBeVisible()
- await expect(metadata.getByText('etalab/schema-irve', { exact: true })).toBeVisible()
- await expect(metadata.getByText('CSV', { exact: true })).toBeVisible()
+ await expect(schema.getByText('etalab/schema-irve', { exact: true })).toBeVisible()
})
test('shows component tags with a stroke, including the linked variant', async ({ page }) => {
From 94b89cbea5bec81cb527245812b69c887eb7aad4 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sat, 14 Nov 2026 21:02:49 +0100
Subject: [PATCH 14/33] fix(design): align tag toggletip and icon order
---
pages/design/tags.vue | 33 ++++++++++------------------
tests/design-tags.logged-out.spec.ts | 6 ++++-
2 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index f2022996f..4a96a873b 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -84,32 +84,23 @@
'data-testid': 'toggletip-tag',
}"
>
- Avec infobulle
-
-
-
+ Avec infobulle
+
+
+
Informations du tag
-
- ×
-
-
-
- Ce tag apporte une information complémentaire au clic.
-
+ Ce tag apporte une information complémentaire au clic.
+
+
- Sélectionnable
+ Sélectionnable
- Supprimable
+ Supprimable
{
await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
await expect(selectableTag.locator('svg')).toHaveCount(1)
await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
+ expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await selectableTag.hover()
@@ -38,6 +39,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(disabledTag).toHaveCSS('background-color', disabledBackground)
const dismissibleTag = page.getByTestId('dismissible-tag')
+ expect(await dismissibleTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
const dismissibleBackground = await dismissibleTag.evaluate(element => getComputedStyle(element).backgroundColor)
await dismissibleTag.hover()
await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
@@ -50,14 +52,16 @@ test('opens and closes a tag toggletip', async ({ page }) => {
await expect(tag).toHaveCSS('font-size', '12px')
await expect(tag).toHaveCSS('min-height', '24px')
await expect(tag.locator('svg')).toHaveCount(1)
+ expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
await tag.click()
await expect(tag).toHaveAttribute('aria-expanded', 'true')
await expect(content).toBeVisible()
+ await expect(content.locator('..').locator('..')).toHaveClass(/p-4/)
- await page.getByTestId('toggletip-tag-close').click()
+ await tag.click()
await expect(tag).toHaveAttribute('aria-expanded', 'false')
await expect(content).toBeHidden()
})
From 9301e61673ee402edc92d82446768daf94add7c2 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sun, 15 Nov 2026 21:20:50 +0100
Subject: [PATCH 15/33] fix(tags): align icons optically
---
assets/css/overrides.css | 14 ++++++++++++++
components/TagsSelect.vue | 2 +-
pages/design/tags.vue | 5 ++++-
tests/design-tags.logged-out.spec.ts | 12 ++++++++++++
4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 23b704d50..e339a5e9a 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -55,6 +55,20 @@
background-color: var(--background-contrast-grey);
}
+/*
+ * Icons have more visual weight than text at the same geometric center.
+ * Keep them first, tighten the icon-side padding and lift them by one pixel so
+ * the glyph aligns with the text's optical center rather than its line box.
+ */
+:is(.fr-tag, .cdata-tag):has(> svg:first-child) {
+ padding-inline-start: 0.375rem;
+}
+
+:is(.fr-tag, .cdata-tag) > svg:first-child {
+ flex: none;
+ transform: translateY(-0.0625rem);
+}
+
/*
* @datagouv/components-next Tag does not expose a bordered variant yet.
* cdata adds the Design Lab stroke to its direct examples and to the tags
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index de3babfba..3e81e824e 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -31,12 +31,12 @@
type="button"
@click="removeTag(tag)"
>
- {{ tag.text }}
+ {{ tag.text }}
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index 4a96a873b..62d7064b3 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -58,7 +58,10 @@
class="fr-tag"
data-testid="static-tag"
>Tag de catégorie
-
+
{
await expect(tag).toHaveCSS('border-top-width', '1px')
}
+ const iconTag = page.getByTestId('icon-tag')
+ await expect(iconTag).toHaveCSS('padding-left', '6px')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await clickableTag.hover()
await expect(clickableTag).not.toHaveCSS('background-color', restBackground)
@@ -28,6 +32,8 @@ test('shows every compact tag state', async ({ page }) => {
await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
await expect(selectableTag.locator('svg')).toHaveCount(1)
await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
+ await expect(selectableTag).toHaveCSS('padding-left', '6px')
+ await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -40,6 +46,7 @@ test('shows every compact tag state', async ({ page }) => {
const dismissibleTag = page.getByTestId('dismissible-tag')
expect(await dismissibleTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
+ await expect(dismissibleTag).toHaveCSS('padding-left', '6px')
const dismissibleBackground = await dismissibleTag.evaluate(element => getComputedStyle(element).backgroundColor)
await dismissibleTag.hover()
await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
@@ -53,6 +60,8 @@ test('opens and closes a tag toggletip', async ({ page }) => {
await expect(tag).toHaveCSS('min-height', '24px')
await expect(tag.locator('svg')).toHaveCount(1)
expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
+ await expect(tag).toHaveCSS('padding-left', '6px')
+ await expect(tag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
@@ -167,6 +176,9 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '18px')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
+ expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
From 29320d723f63a0592fd0911fbcfd715ada1ffd9c Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sun, 15 Nov 2026 21:29:44 +0100
Subject: [PATCH 16/33] fix(tags): normalize icon geometry
---
assets/css/overrides.css | 25 ++++++++++++++++++++-----
tests/design-tags.logged-out.spec.ts | 15 +++++++++++----
2 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index e339a5e9a..19553fa53 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -57,16 +57,31 @@
/*
* Icons have more visual weight than text at the same geometric center.
- * Keep them first, tighten the icon-side padding and lift them by one pixel so
- * the glyph aligns with the text's optical center rather than its line box.
+ * Keep them first, tighten the icon-side padding and lift each implementation
+ * just enough to align the glyph with the text rather than its line box.
*/
-:is(.fr-tag, .cdata-tag):has(> svg:first-child) {
+.fr-tag:has(> svg:first-child) {
padding-inline-start: 0.375rem;
}
-:is(.fr-tag, .cdata-tag) > svg:first-child {
+.fr-tag > svg:first-child {
flex: none;
- transform: translateY(-0.0625rem);
+ width: 0.875rem;
+ height: 0.875rem;
+ transform: translateY(-0.03125rem);
+}
+
+@layer utilities {
+ .cdata-tag:has(> svg:first-child) {
+ padding-inline-start: 0.375rem !important;
+ }
+
+ .cdata-tag > svg:first-child {
+ flex: none;
+ width: 0.875rem !important;
+ height: 0.875rem !important;
+ transform: translateY(-0.0625rem);
+ }
}
/*
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 1e279adf7..fc7a33033 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -20,7 +20,9 @@ test('shows every compact tag state', async ({ page }) => {
const iconTag = page.getByTestId('icon-tag')
await expect(iconTag).toHaveCSS('padding-left', '6px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await clickableTag.hover()
@@ -33,7 +35,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(selectableTag.locator('svg')).toHaveCount(1)
await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
await expect(selectableTag).toHaveCSS('padding-left', '6px')
- await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -61,7 +63,7 @@ test('opens and closes a tag toggletip', async ({ page }) => {
await expect(tag.locator('svg')).toHaveCount(1)
expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(tag).toHaveCSS('padding-left', '6px')
- await expect(tag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(tag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
@@ -161,6 +163,10 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(tag).toHaveCSS('min-height', '24px')
}
+ await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+
const link = linkedTag.locator('..')
const restBackground = await linkedTag.evaluate(element => getComputedStyle(element).backgroundColor)
await link.hover()
@@ -178,7 +184,8 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
From dd1aa66b02a2dc032dbc532aed38046a25fb187c Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sun, 15 Nov 2026 21:39:49 +0100
Subject: [PATCH 17/33] fix(tags): center icons without offsets
---
assets/css/overrides.css | 17 ++++++++++++-----
tests/design-tags.logged-out.spec.ts | 11 ++++++-----
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 19553fa53..d007af996 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -56,9 +56,10 @@
}
/*
- * Icons have more visual weight than text at the same geometric center.
- * Keep them first, tighten the icon-side padding and lift each implementation
- * just enough to align the glyph with the text rather than its line box.
+ * Keep one 14 px icon frame and vertically center it with the 18 px text line.
+ * Optical corrections belong to the icon artwork/live area, not to per-use
+ * CSS translations: this follows the Design Lab proposal and avoids different
+ * alignment depending on the icon shape.
*/
.fr-tag:has(> svg:first-child) {
padding-inline-start: 0.375rem;
@@ -68,7 +69,7 @@
flex: none;
width: 0.875rem;
height: 0.875rem;
- transform: translateY(-0.03125rem);
+ transform: none;
}
@layer utilities {
@@ -80,7 +81,13 @@
flex: none;
width: 0.875rem !important;
height: 0.875rem !important;
- transform: translateY(-0.0625rem);
+ transform: none;
+ }
+
+ /* The shared Tag currently lifts its text by 1 px; undo it locally so both
+ * flex items use the same visual centre as the Design Lab proposal. */
+ .cdata-tag > span.-mt-px {
+ margin-top: 0 !important;
}
}
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index fc7a33033..7efe060c9 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -22,7 +22,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(iconTag).toHaveCSS('padding-left', '6px')
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await clickableTag.hover()
@@ -35,7 +35,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(selectableTag.locator('svg')).toHaveCount(1)
await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
await expect(selectableTag).toHaveCSS('padding-left', '6px')
- await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
+ await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'none')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -63,7 +63,7 @@ test('opens and closes a tag toggletip', async ({ page }) => {
await expect(tag.locator('svg')).toHaveCount(1)
expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(tag).toHaveCSS('padding-left', '6px')
- await expect(tag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
+ await expect(tag.locator('svg')).toHaveCSS('transform', 'none')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
@@ -165,7 +165,8 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '0px')
const link = linkedTag.locator('..')
const restBackground = await linkedTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -185,7 +186,7 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -0.5)')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'none')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
From 0f358a4c9d818f8df1515c5533b3d156d3ef006f Mon Sep 17 00:00:00 2001
From: agarrone
Date: Sun, 15 Nov 2026 21:44:48 +0100
Subject: [PATCH 18/33] fix(tags): tune optical icon alignment
---
assets/css/overrides.css | 10 +++++-----
tests/design-tags.logged-out.spec.ts | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index d007af996..8970b0603 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -57,9 +57,9 @@
/*
* Keep one 14 px icon frame and vertically center it with the 18 px text line.
- * Optical corrections belong to the icon artwork/live area, not to per-use
- * CSS translations: this follows the Design Lab proposal and avoids different
- * alignment depending on the icon shape.
+ * The visible glyphs sit slightly below the mathematical centre of that line,
+ * so move every icon down by one whole pixel as a single optical correction.
+ * A whole pixel keeps the compact SVGs sharp and avoids per-icon offsets.
*/
.fr-tag:has(> svg:first-child) {
padding-inline-start: 0.375rem;
@@ -69,7 +69,7 @@
flex: none;
width: 0.875rem;
height: 0.875rem;
- transform: none;
+ transform: translateY(1px);
}
@layer utilities {
@@ -81,7 +81,7 @@
flex: none;
width: 0.875rem !important;
height: 0.875rem !important;
- transform: none;
+ transform: translateY(1px);
}
/* The shared Tag currently lifts its text by 1 px; undo it locally so both
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 7efe060c9..fd1c30995 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -22,7 +22,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(iconTag).toHaveCSS('padding-left', '6px')
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await clickableTag.hover()
@@ -35,7 +35,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(selectableTag.locator('svg')).toHaveCount(1)
await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
await expect(selectableTag).toHaveCSS('padding-left', '6px')
- await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -63,7 +63,7 @@ test('opens and closes a tag toggletip', async ({ page }) => {
await expect(tag.locator('svg')).toHaveCount(1)
expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(tag).toHaveCSS('padding-left', '6px')
- await expect(tag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(tag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
@@ -165,7 +165,7 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '0px')
const link = linkedTag.locator('..')
@@ -186,7 +186,7 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'none')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
From 98ee36e73455a995eb3892b556c21783df67d88f Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 10:20:59 +0100
Subject: [PATCH 19/33] fix(tags): unify compact typography
---
assets/css/overrides.css | 12 +++++++-----
components/AdminBadge/AdminBadge.vue | 2 +-
components/TagsSelect.vue | 2 +-
pages/design/tags.vue | 8 ++++----
tests/design-tags.logged-out.spec.ts | 21 ++++++++++++++-------
5 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 8970b0603..60ab843e9 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -56,7 +56,7 @@
}
/*
- * Keep one 14 px icon frame and vertically center it with the 18 px text line.
+ * Keep one 12 px icon frame and vertically center it with the 18 px text line.
* The visible glyphs sit slightly below the mathematical centre of that line,
* so move every icon down by one whole pixel as a single optical correction.
* A whole pixel keeps the compact SVGs sharp and avoids per-icon offsets.
@@ -67,8 +67,8 @@
.fr-tag > svg:first-child {
flex: none;
- width: 0.875rem;
- height: 0.875rem;
+ width: 0.75rem !important;
+ height: 0.75rem !important;
transform: translateY(1px);
}
@@ -79,8 +79,8 @@
.cdata-tag > svg:first-child {
flex: none;
- width: 0.875rem !important;
- height: 0.875rem !important;
+ width: 0.75rem !important;
+ height: 0.75rem !important;
transform: translateY(1px);
}
@@ -102,6 +102,8 @@
box-sizing: border-box;
min-height: 1.5rem;
border: 1px solid var(--border-default-grey) !important;
+ font-weight: 400 !important;
+ line-height: 1.125rem !important;
}
.cdata-tag-link:hover > .cdata-tag,
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
index 2fc9cef66..59bd11300 100644
--- a/components/AdminBadge/AdminBadge.vue
+++ b/components/AdminBadge/AdminBadge.vue
@@ -69,7 +69,7 @@ const iconSize = computed(() => props.iconSize || 'size-3.5')
border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
border-radius: 0.375rem;
font-size: 0.75rem;
- font-weight: 500;
+ font-weight: 400;
line-height: 1.125rem;
text-transform: none;
vertical-align: middle;
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 3e81e824e..234a4c5b1 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -32,7 +32,7 @@
@click="removeTag(tag)"
>
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index 62d7064b3..73bb62a91 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -63,7 +63,7 @@
data-testid="icon-tag"
>
Avec icône
@@ -88,7 +88,7 @@
}"
>
Avec infobulle
@@ -115,7 +115,7 @@
>
Sélectionnable
@@ -127,7 +127,7 @@
aria-label="Supprimer le tag supprimable"
>
Supprimable
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index fd1c30995..bcaa7e12f 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -13,6 +13,7 @@ test('shows every compact tag state', async ({ page }) => {
for (const tag of [staticTag, clickableTag, selectableTag, disabledTag]) {
await expect(tag).toHaveCSS('font-size', '12px')
+ await expect(tag).toHaveCSS('font-weight', '400')
await expect(tag).toHaveCSS('line-height', '18px')
await expect(tag).toHaveCSS('min-height', '24px')
await expect(tag).toHaveCSS('border-top-width', '1px')
@@ -20,8 +21,8 @@ test('shows every compact tag state', async ({ page }) => {
const iconTag = page.getByTestId('icon-tag')
await expect(iconTag).toHaveCSS('padding-left', '6px')
- await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('width', '12px')
+ await expect(iconTag.locator('svg')).toHaveCSS('height', '12px')
await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -33,7 +34,7 @@ test('shows every compact tag state', async ({ page }) => {
await selectableTag.click()
await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
await expect(selectableTag.locator('svg')).toHaveCount(1)
- await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
+ await expect(selectableTag.locator('svg')).toHaveCSS('width', '12px')
await expect(selectableTag).toHaveCSS('padding-left', '6px')
await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
@@ -89,6 +90,7 @@ test('shows the business labels used by cards', async ({ page }) => {
const cardBadges = labels.locator('.admin-badge')
await expect(cardBadges).toHaveCount(6)
await expect(cardBadges.first()).toHaveCSS('min-height', '24px')
+ await expect(cardBadges.first()).toHaveCSS('font-weight', '400')
await expect(cardBadges.first().locator('svg')).toHaveCSS('width', '14px')
for (const [cardLabel, tableStatus] of [['Brouillon', 'Brouillon'], ['Archivé', 'Archivé'], ['Accès restreint', 'Archivé'], ['Supprimé', 'Supprimé'], ['Service public', 'Public']]) {
@@ -141,6 +143,7 @@ test('shows the statuses used in tables', async ({ page }) => {
const badges = statuses.locator('.admin-badge')
await expect(badges).toHaveCount(18)
await expect(badges.first()).toHaveCSS('min-height', '20px')
+ await expect(badges.first()).toHaveCSS('font-weight', '400')
await expect(badges.first()).toHaveCSS('line-height', '16px')
await expect(badges.first()).toHaveCSS('padding-top', '1px')
await expect(badges.first()).toHaveCSS('padding-bottom', '1px')
@@ -161,10 +164,12 @@ test('shows component tags with a stroke, including the linked variant', async (
for (const tag of [staticTag, iconTag, linkedTag]) {
await expect(tag).toHaveCSS('border-top-width', '1px')
await expect(tag).toHaveCSS('min-height', '24px')
+ await expect(tag).toHaveCSS('font-weight', '400')
+ await expect(tag).toHaveCSS('line-height', '18px')
}
- await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('width', '12px')
+ await expect(iconTag.locator('svg')).toHaveCSS('height', '12px')
await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '0px')
@@ -180,12 +185,13 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
const selectedTags = page.getByTestId('selected-tags')
await expect(selectedTags.getByRole('button')).toHaveCount(3)
await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-weight', '400')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '18px')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '12px')
expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '12px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
@@ -200,6 +206,7 @@ test('shows DatasetLabelTag with and without a link', async ({ page }) => {
await expect(staticLabel).not.toHaveAttribute('href')
await expect(linkedLabel).toHaveAttribute('href', '/datasets/search?badge=hvd')
await expect(staticLabel).toHaveCSS('line-height', '18px')
+ await expect(staticLabel).toHaveCSS('font-weight', '400')
await expect(linkedLabel).toHaveCSS('min-height', '24px')
await expect(linkedLabel.locator('img')).toHaveCSS('width', '14px')
await expect(linkedLabel.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
From 0a39c3c950227b5ea3e6c70f958c91d47698a776 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 10:22:20 +0100
Subject: [PATCH 20/33] fix(tags): keep all compact icons at 14px
---
assets/css/overrides.css | 10 +++++-----
components/TagsSelect.vue | 2 +-
pages/design/tags.vue | 8 ++++----
tests/design-tags.logged-out.spec.ts | 14 +++++++-------
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 60ab843e9..aaa60d637 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -56,7 +56,7 @@
}
/*
- * Keep one 12 px icon frame and vertically center it with the 18 px text line.
+ * Keep one 14 px icon frame and vertically center it with the 18 px text line.
* The visible glyphs sit slightly below the mathematical centre of that line,
* so move every icon down by one whole pixel as a single optical correction.
* A whole pixel keeps the compact SVGs sharp and avoids per-icon offsets.
@@ -67,8 +67,8 @@
.fr-tag > svg:first-child {
flex: none;
- width: 0.75rem !important;
- height: 0.75rem !important;
+ width: 0.875rem !important;
+ height: 0.875rem !important;
transform: translateY(1px);
}
@@ -79,8 +79,8 @@
.cdata-tag > svg:first-child {
flex: none;
- width: 0.75rem !important;
- height: 0.75rem !important;
+ width: 0.875rem !important;
+ height: 0.875rem !important;
transform: translateY(1px);
}
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 234a4c5b1..3e81e824e 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -32,7 +32,7 @@
@click="removeTag(tag)"
>
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index 73bb62a91..62d7064b3 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -63,7 +63,7 @@
data-testid="icon-tag"
>
Avec icône
@@ -88,7 +88,7 @@
}"
>
Avec infobulle
@@ -115,7 +115,7 @@
>
Sélectionnable
@@ -127,7 +127,7 @@
aria-label="Supprimer le tag supprimable"
>
Supprimable
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index bcaa7e12f..290c0c565 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -21,8 +21,8 @@ test('shows every compact tag state', async ({ page }) => {
const iconTag = page.getByTestId('icon-tag')
await expect(iconTag).toHaveCSS('padding-left', '6px')
- await expect(iconTag.locator('svg')).toHaveCSS('width', '12px')
- await expect(iconTag.locator('svg')).toHaveCSS('height', '12px')
+ await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -34,7 +34,7 @@ test('shows every compact tag state', async ({ page }) => {
await selectableTag.click()
await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
await expect(selectableTag.locator('svg')).toHaveCount(1)
- await expect(selectableTag.locator('svg')).toHaveCSS('width', '12px')
+ await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
await expect(selectableTag).toHaveCSS('padding-left', '6px')
await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
@@ -168,8 +168,8 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(tag).toHaveCSS('line-height', '18px')
}
- await expect(iconTag.locator('svg')).toHaveCSS('width', '12px')
- await expect(iconTag.locator('svg')).toHaveCSS('height', '12px')
+ await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
+ await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '0px')
@@ -188,10 +188,10 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-weight', '400')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '18px')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '12px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '12px')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
From d9d56cffdc8b6a8c83e9598cf06c07da08276ffb Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 10:25:51 +0100
Subject: [PATCH 21/33] fix(tags): remove neutral pill backgrounds
---
assets/css/overrides.css | 7 ++++---
components/AccessTypes/AccessTypeBadge.vue | 1 +
pages/design/tags.vue | 1 +
tests/design-tags.logged-out.spec.ts | 10 +++++++++-
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index aaa60d637..17700293d 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -52,7 +52,7 @@
border: 1px solid var(--border-default-grey);
border-radius: 0.75rem;
color: var(--text-label-grey);
- background-color: var(--background-contrast-grey);
+ background-color: transparent;
}
/*
@@ -104,6 +104,7 @@
border: 1px solid var(--border-default-grey) !important;
font-weight: 400 !important;
line-height: 1.125rem !important;
+ background-color: transparent !important;
}
.cdata-tag-link:hover > .cdata-tag,
@@ -125,7 +126,7 @@
:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]) {
color: var(--text-label-grey);
- background-color: var(--background-contrast-grey);
+ background-color: transparent;
--hover: var(--background-action-low-blue-france);
--active: var(--background-action-low-blue-france-active);
--hover-tint: var(--background-action-low-blue-france);
@@ -201,7 +202,7 @@
line-height: 1.125rem !important;
text-transform: none !important;
color: var(--text-label-grey) !important;
- background-color: var(--background-contrast-grey) !important;
+ background-color: transparent !important;
gap: 0.25rem !important;
}
diff --git a/components/AccessTypes/AccessTypeBadge.vue b/components/AccessTypes/AccessTypeBadge.vue
index 07dbf3f55..15120c5d8 100644
--- a/components/AccessTypes/AccessTypeBadge.vue
+++ b/components/AccessTypes/AccessTypeBadge.vue
@@ -1,5 +1,6 @@
{
await expect(tag).toHaveCSS('border-top-width', '1px')
}
+ await expect(staticTag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+ await expect(clickableTag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+
const iconTag = page.getByTestId('icon-tag')
await expect(iconTag).toHaveCSS('padding-left', '6px')
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
@@ -90,7 +93,7 @@ test('shows the business labels used by cards', async ({ page }) => {
const cardBadges = labels.locator('.admin-badge')
await expect(cardBadges).toHaveCount(6)
await expect(cardBadges.first()).toHaveCSS('min-height', '24px')
- await expect(cardBadges.first()).toHaveCSS('font-weight', '400')
+ await expect(cardBadges.first()).toHaveCSS('font-weight', '500')
await expect(cardBadges.first().locator('svg')).toHaveCSS('width', '14px')
for (const [cardLabel, tableStatus] of [['Brouillon', 'Brouillon'], ['Archivé', 'Archivé'], ['Accès restreint', 'Archivé'], ['Supprimé', 'Supprimé'], ['Service public', 'Public']]) {
@@ -124,6 +127,9 @@ test('shows API access types with the account-only yellow tone', async ({ page }
await expect(openBadge.locator('svg')).toHaveCount(0)
await expect(accountBadge.locator('svg')).toHaveCount(1)
await expect(restrictedBadge.locator('svg')).toHaveCount(1)
+ await expect(openBadge).toHaveCSS('font-weight', '500')
+ await expect(accountBadge).toHaveCSS('font-weight', '500')
+ await expect(restrictedBadge).toHaveCSS('font-weight', '500')
await expect(accountBadge.locator('svg')).toHaveCSS('width', '14px')
await expect(restrictedBadge.locator('svg')).toHaveCSS('width', '14px')
await expect(accountBadge).not.toHaveCSS('background-color', await restrictedBadge.evaluate(element => getComputedStyle(element).backgroundColor))
@@ -166,6 +172,7 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(tag).toHaveCSS('min-height', '24px')
await expect(tag).toHaveCSS('font-weight', '400')
await expect(tag).toHaveCSS('line-height', '18px')
+ await expect(tag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
}
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
@@ -207,6 +214,7 @@ test('shows DatasetLabelTag with and without a link', async ({ page }) => {
await expect(linkedLabel).toHaveAttribute('href', '/datasets/search?badge=hvd')
await expect(staticLabel).toHaveCSS('line-height', '18px')
await expect(staticLabel).toHaveCSS('font-weight', '400')
+ await expect(staticLabel).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
await expect(linkedLabel).toHaveCSS('min-height', '24px')
await expect(linkedLabel.locator('img')).toHaveCSS('width', '14px')
await expect(linkedLabel.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
From 062b0a36590012221baded0c614e920399545ba2 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 10:41:26 +0100
Subject: [PATCH 22/33] fix(tags): align tooltip content styling
---
pages/design/tags.vue | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index 96e2f371d..abf032aa8 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -93,10 +93,10 @@
/>
Avec infobulle
-
-
+
+
Date: Mon, 16 Nov 2026 11:10:24 +0100
Subject: [PATCH 23/33] fix(badges): apply per-icon optical alignment
---
assets/css/overrides.css | 23 +++++++---
components/AdminBadge/AdminBadge.vue | 66 ++++++++++++++++++++++++++--
components/TagsSelect.vue | 2 +-
pages/design/tags.vue | 10 ++---
tests/design-tags.logged-out.spec.ts | 8 ++++
5 files changed, 94 insertions(+), 15 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 17700293d..7baf4f509 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -56,20 +56,27 @@
}
/*
- * Keep one 14 px icon frame and vertically center it with the 18 px text line.
- * The visible glyphs sit slightly below the mathematical centre of that line,
- * so move every icon down by one whole pixel as a single optical correction.
- * A whole pixel keeps the compact SVGs sharp and avoids per-icon offsets.
+ * Keep one 14 px icon frame. Optical offsets are declared by each icon usage:
+ * SVG drawings have different centres of visual weight even when their
+ * mathematical boxes are identical.
*/
.fr-tag:has(> svg:first-child) {
padding-inline-start: 0.375rem;
}
.fr-tag > svg:first-child {
+ display: block;
flex: none;
width: 0.875rem !important;
height: 0.875rem !important;
- transform: translateY(1px);
+ transform: translate(
+ var(--cdata-icon-offset-x, 0),
+ var(--cdata-icon-offset-y, 0)
+ );
+}
+
+.cdata-icon-offset-y-1 {
+ --cdata-icon-offset-y: 1px;
}
@layer utilities {
@@ -78,10 +85,14 @@
}
.cdata-tag > svg:first-child {
+ display: block;
flex: none;
width: 0.875rem !important;
height: 0.875rem !important;
- transform: translateY(1px);
+ transform: translate(
+ var(--cdata-icon-offset-x, 0),
+ var(--cdata-icon-offset-y, 0)
+ );
}
/* The shared Tag currently lifts its text by 1 px; undo it locally so both
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
index 59bd11300..ec26cd456 100644
--- a/components/AdminBadge/AdminBadge.vue
+++ b/components/AdminBadge/AdminBadge.vue
@@ -9,10 +9,13 @@
v-if="icon"
class="admin-badge__icon"
:class="iconSize"
+ :style="leftIconStyle"
+ :data-optical-offset-x="leftIconOffset.x"
+ :data-optical-offset-y="leftIconOffset.y"
aria-hidden="true"
focusable="false"
/>
-
+
@@ -35,6 +41,10 @@ const props = withDefaults(defineProps<{
size: 'xs' | 'sm'
icon?: Component
iconRight?: Component
+ iconOffsetX?: -1 | 0 | 1
+ iconOffsetY?: -1 | 0 | 1
+ iconRightOffsetX?: -1 | 0 | 1
+ iconRightOffsetY?: -1 | 0 | 1
noWrap?: boolean
iconSize?: string
}>(), {
@@ -57,6 +67,45 @@ const colors = computed(() => {
})
const iconSize = computed(() => props.iconSize || 'size-3.5')
+
+type OpticalOffset = { x: -1 | 0 | 1, y: -1 | 0 | 1 }
+
+// Remix icons share a 24 px canvas, but their visible weight does not always
+// share its mathematical centre. These small, measured adjustments keep the
+// 14 px glyphs aligned optically with the compact 12 px label.
+const opticalOffsets: Record = {
+ RiArchiveLine: { x: 0, y: 1 },
+ RiDeleteBinLine: { x: 0, y: 1 },
+ RiDraftLine: { x: 0, y: 1 },
+ RiExternalLinkLine: { x: 0, y: 1 },
+ RiGovernmentLine: { x: 0, y: 1 },
+ RiPassValidLine: { x: 0, y: 1 },
+ // The lock glyph is bottom-heavy, so flex centring already aligns it with
+ // the text without the downward adjustment used by the other icons.
+ RiLockLine: { x: 0, y: 0 },
+}
+
+function componentName(component?: Component): string {
+ if (component && typeof component === 'object' && 'name' in component)
+ return String(component.name ?? '')
+ return ''
+}
+
+function resolveOffset(component: Component | undefined, x: -1 | 0 | 1 | undefined, y: -1 | 0 | 1 | undefined): OpticalOffset {
+ const measured = opticalOffsets[componentName(component)] ?? { x: 0, y: 0 }
+ return { x: x ?? measured.x, y: y ?? measured.y }
+}
+
+const leftIconOffset = computed(() => resolveOffset(props.icon, props.iconOffsetX, props.iconOffsetY))
+const rightIconOffset = computed(() => resolveOffset(props.iconRight, props.iconRightOffsetX, props.iconRightOffsetY))
+const leftIconStyle = computed(() => ({
+ '--admin-badge-icon-offset-x': `${leftIconOffset.value.x}px`,
+ '--admin-badge-icon-offset-y': `${leftIconOffset.value.y}px`,
+}))
+const rightIconStyle = computed(() => ({
+ '--admin-badge-icon-offset-x': `${rightIconOffset.value.x}px`,
+ '--admin-badge-icon-offset-y': `${rightIconOffset.value.y}px`,
+}))
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 3e81e824e..662178dec 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -32,7 +32,7 @@
@click="removeTag(tag)"
>
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index abf032aa8..c5f7c6b6e 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -29,7 +29,7 @@
Données ouvertes
@@ -63,7 +63,7 @@
data-testid="icon-tag"
>
Avec icône
@@ -88,7 +88,7 @@
}"
>
Avec infobulle
@@ -115,7 +115,7 @@
>
Sélectionnable
@@ -127,7 +127,7 @@
aria-label="Supprimer le tag supprimable"
>
Supprimable
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 99bf6e0ae..75e20198c 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -111,6 +111,12 @@ test('shows the business labels used by cards', async ({ page }) => {
const draftIcon = cardBadges.filter({ hasText: 'Brouillon' }).locator('svg')
const restrictedIcon = cardBadges.filter({ hasText: 'Accès restreint' }).locator('svg')
expect(await draftIcon.innerHTML()).not.toBe(await restrictedIcon.innerHTML())
+ await expect(draftIcon).toHaveAttribute('data-optical-offset-y', '1')
+ await expect(cardBadges.filter({ hasText: 'Archivé' }).locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
+ await expect(restrictedIcon).toHaveAttribute('data-optical-offset-y', '0')
+ await expect(accountCardBadge.locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
+ await expect(cardBadges.filter({ hasText: 'Supprimé' }).locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
+ await expect(cardBadges.filter({ hasText: 'Service public' }).locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
})
test('shows API access types with the account-only yellow tone', async ({ page }) => {
@@ -132,6 +138,8 @@ test('shows API access types with the account-only yellow tone', async ({ page }
await expect(restrictedBadge).toHaveCSS('font-weight', '500')
await expect(accountBadge.locator('svg')).toHaveCSS('width', '14px')
await expect(restrictedBadge.locator('svg')).toHaveCSS('width', '14px')
+ await expect(accountBadge.locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
+ await expect(restrictedBadge.locator('svg')).toHaveAttribute('data-optical-offset-y', '0')
await expect(accountBadge).not.toHaveCSS('background-color', await restrictedBadge.evaluate(element => getComputedStyle(element).backgroundColor))
})
From 20202bd221b1e41a686297da56521e499dbeaf34 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 11:33:12 +0100
Subject: [PATCH 24/33] fix(badges): lift compact labels optically
---
components/AdminBadge/AdminBadge.vue | 2 +-
tests/design-tags.logged-out.spec.ts | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
index ec26cd456..b1c44cb6a 100644
--- a/components/AdminBadge/AdminBadge.vue
+++ b/components/AdminBadge/AdminBadge.vue
@@ -130,7 +130,7 @@ const rightIconStyle = computed(() => ({
line-height: 1rem;
}
-.admin-badge[data-size="xs"] > .admin-badge__label {
+.admin-badge__label {
transform: translateY(-0.0625rem);
}
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 75e20198c..44b9a5035 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -95,6 +95,7 @@ test('shows the business labels used by cards', async ({ page }) => {
await expect(cardBadges.first()).toHaveCSS('min-height', '24px')
await expect(cardBadges.first()).toHaveCSS('font-weight', '500')
await expect(cardBadges.first().locator('svg')).toHaveCSS('width', '14px')
+ await expect(cardBadges.first().locator('.admin-badge__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
for (const [cardLabel, tableStatus] of [['Brouillon', 'Brouillon'], ['Archivé', 'Archivé'], ['Accès restreint', 'Archivé'], ['Supprimé', 'Supprimé'], ['Service public', 'Public']]) {
const cardBadge = cardBadges.filter({ hasText: cardLabel })
From 95a516559db5bbe9c199ea8f2427186097950c45 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 11:46:56 +0100
Subject: [PATCH 25/33] fix(badges): center compact content geometrically
---
assets/css/overrides.css | 23 +++------
components/AdminBadge/AdminBadge.vue | 71 ++++------------------------
components/TagsSelect.vue | 2 +-
pages/design/tags.vue | 10 ++--
tests/design-tags.logged-out.spec.ts | 51 ++++++++++++--------
5 files changed, 52 insertions(+), 105 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index 7baf4f509..b24352f1f 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -46,7 +46,8 @@
gap: 0.25rem;
font-size: 0.75rem;
font-weight: 400;
- line-height: 1.125rem;
+ line-height: 1.5rem;
+ height: 1.5rem;
min-height: 1.5rem;
padding: 0.125rem 0.5rem;
border: 1px solid var(--border-default-grey);
@@ -56,9 +57,8 @@
}
/*
- * Keep one 14 px icon frame. Optical offsets are declared by each icon usage:
- * SVG drawings have different centres of visual weight even when their
- * mathematical boxes are identical.
+ * Keep one 14 px icon frame. The text line box fills the 24 px tag and flex
+ * alignment centres the icon inside that same box, without vertical offsets.
*/
.fr-tag:has(> svg:first-child) {
padding-inline-start: 0.375rem;
@@ -69,14 +69,6 @@
flex: none;
width: 0.875rem !important;
height: 0.875rem !important;
- transform: translate(
- var(--cdata-icon-offset-x, 0),
- var(--cdata-icon-offset-y, 0)
- );
-}
-
-.cdata-icon-offset-y-1 {
- --cdata-icon-offset-y: 1px;
}
@layer utilities {
@@ -89,10 +81,6 @@
flex: none;
width: 0.875rem !important;
height: 0.875rem !important;
- transform: translate(
- var(--cdata-icon-offset-x, 0),
- var(--cdata-icon-offset-y, 0)
- );
}
/* The shared Tag currently lifts its text by 1 px; undo it locally so both
@@ -111,10 +99,11 @@
.cdata-tag,
.cdata-dataset-information .fr-raw-link > span {
box-sizing: border-box;
+ height: 1.5rem;
min-height: 1.5rem;
border: 1px solid var(--border-default-grey) !important;
font-weight: 400 !important;
- line-height: 1.125rem !important;
+ line-height: 1.5rem !important;
background-color: transparent !important;
}
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
index b1c44cb6a..719db3b0d 100644
--- a/components/AdminBadge/AdminBadge.vue
+++ b/components/AdminBadge/AdminBadge.vue
@@ -9,9 +9,6 @@
v-if="icon"
class="admin-badge__icon"
:class="iconSize"
- :style="leftIconStyle"
- :data-optical-offset-x="leftIconOffset.x"
- :data-optical-offset-y="leftIconOffset.y"
aria-hidden="true"
focusable="false"
/>
@@ -23,9 +20,6 @@
v-if="iconRight"
class="admin-badge__icon"
:class="iconSize"
- :style="rightIconStyle"
- :data-optical-offset-x="rightIconOffset.x"
- :data-optical-offset-y="rightIconOffset.y"
aria-hidden="true"
focusable="false"
/>
@@ -41,10 +35,6 @@ const props = withDefaults(defineProps<{
size: 'xs' | 'sm'
icon?: Component
iconRight?: Component
- iconOffsetX?: -1 | 0 | 1
- iconOffsetY?: -1 | 0 | 1
- iconRightOffsetX?: -1 | 0 | 1
- iconRightOffsetY?: -1 | 0 | 1
noWrap?: boolean
iconSize?: string
}>(), {
@@ -67,51 +57,13 @@ const colors = computed(() => {
})
const iconSize = computed(() => props.iconSize || 'size-3.5')
-
-type OpticalOffset = { x: -1 | 0 | 1, y: -1 | 0 | 1 }
-
-// Remix icons share a 24 px canvas, but their visible weight does not always
-// share its mathematical centre. These small, measured adjustments keep the
-// 14 px glyphs aligned optically with the compact 12 px label.
-const opticalOffsets: Record = {
- RiArchiveLine: { x: 0, y: 1 },
- RiDeleteBinLine: { x: 0, y: 1 },
- RiDraftLine: { x: 0, y: 1 },
- RiExternalLinkLine: { x: 0, y: 1 },
- RiGovernmentLine: { x: 0, y: 1 },
- RiPassValidLine: { x: 0, y: 1 },
- // The lock glyph is bottom-heavy, so flex centring already aligns it with
- // the text without the downward adjustment used by the other icons.
- RiLockLine: { x: 0, y: 0 },
-}
-
-function componentName(component?: Component): string {
- if (component && typeof component === 'object' && 'name' in component)
- return String(component.name ?? '')
- return ''
-}
-
-function resolveOffset(component: Component | undefined, x: -1 | 0 | 1 | undefined, y: -1 | 0 | 1 | undefined): OpticalOffset {
- const measured = opticalOffsets[componentName(component)] ?? { x: 0, y: 0 }
- return { x: x ?? measured.x, y: y ?? measured.y }
-}
-
-const leftIconOffset = computed(() => resolveOffset(props.icon, props.iconOffsetX, props.iconOffsetY))
-const rightIconOffset = computed(() => resolveOffset(props.iconRight, props.iconRightOffsetX, props.iconRightOffsetY))
-const leftIconStyle = computed(() => ({
- '--admin-badge-icon-offset-x': `${leftIconOffset.value.x}px`,
- '--admin-badge-icon-offset-y': `${leftIconOffset.value.y}px`,
-}))
-const rightIconStyle = computed(() => ({
- '--admin-badge-icon-offset-x': `${rightIconOffset.value.x}px`,
- '--admin-badge-icon-offset-y': `${rightIconOffset.value.y}px`,
-}))
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 662178dec..3e81e824e 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -32,7 +32,7 @@
@click="removeTag(tag)"
>
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index c5f7c6b6e..abf032aa8 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -29,7 +29,7 @@
Données ouvertes
@@ -63,7 +63,7 @@
data-testid="icon-tag"
>
Avec icône
@@ -88,7 +88,7 @@
}"
>
Avec infobulle
@@ -115,7 +115,7 @@
>
Sélectionnable
@@ -127,7 +127,7 @@
aria-label="Supprimer le tag supprimable"
>
Supprimable
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index 44b9a5035..e017f4143 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -14,7 +14,8 @@ test('shows every compact tag state', async ({ page }) => {
for (const tag of [staticTag, clickableTag, selectableTag, disabledTag]) {
await expect(tag).toHaveCSS('font-size', '12px')
await expect(tag).toHaveCSS('font-weight', '400')
- await expect(tag).toHaveCSS('line-height', '18px')
+ await expect(tag).toHaveCSS('line-height', '24px')
+ await expect(tag).toHaveCSS('height', '24px')
await expect(tag).toHaveCSS('min-height', '24px')
await expect(tag).toHaveCSS('border-top-width', '1px')
}
@@ -26,7 +27,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(iconTag).toHaveCSS('padding-left', '6px')
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await clickableTag.hover()
@@ -39,7 +40,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(selectableTag.locator('svg')).toHaveCount(1)
await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
await expect(selectableTag).toHaveCSS('padding-left', '6px')
- await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
+ await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'none')
expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -67,7 +68,7 @@ test('opens and closes a tag toggletip', async ({ page }) => {
await expect(tag.locator('svg')).toHaveCount(1)
expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(tag).toHaveCSS('padding-left', '6px')
- await expect(tag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
+ await expect(tag.locator('svg')).toHaveCSS('transform', 'none')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
@@ -95,7 +96,23 @@ test('shows the business labels used by cards', async ({ page }) => {
await expect(cardBadges.first()).toHaveCSS('min-height', '24px')
await expect(cardBadges.first()).toHaveCSS('font-weight', '500')
await expect(cardBadges.first().locator('svg')).toHaveCSS('width', '14px')
- await expect(cardBadges.first().locator('.admin-badge__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(cardBadges.first()).toHaveCSS('height', '24px')
+ await expect(cardBadges.first()).toHaveCSS('line-height', '24px')
+ await expect(cardBadges.first().locator('.admin-badge__label')).toHaveCSS('transform', 'none')
+
+ const geometry = await cardBadges.first().evaluate((element) => {
+ const badge = element.getBoundingClientRect()
+ const label = element.querySelector('.admin-badge__label')?.getBoundingClientRect()
+ const icon = element.querySelector('svg')?.getBoundingClientRect()
+ const badgeCenter = badge.top + badge.height / 2
+
+ return {
+ labelCenterDelta: label ? label.top + label.height / 2 - badgeCenter : null,
+ iconCenterDelta: icon ? icon.top + icon.height / 2 - badgeCenter : null,
+ }
+ })
+ expect(geometry.labelCenterDelta).toBeCloseTo(0, 5)
+ expect(geometry.iconCenterDelta).toBeCloseTo(0, 5)
for (const [cardLabel, tableStatus] of [['Brouillon', 'Brouillon'], ['Archivé', 'Archivé'], ['Accès restreint', 'Archivé'], ['Supprimé', 'Supprimé'], ['Service public', 'Public']]) {
const cardBadge = cardBadges.filter({ hasText: cardLabel })
@@ -112,12 +129,8 @@ test('shows the business labels used by cards', async ({ page }) => {
const draftIcon = cardBadges.filter({ hasText: 'Brouillon' }).locator('svg')
const restrictedIcon = cardBadges.filter({ hasText: 'Accès restreint' }).locator('svg')
expect(await draftIcon.innerHTML()).not.toBe(await restrictedIcon.innerHTML())
- await expect(draftIcon).toHaveAttribute('data-optical-offset-y', '1')
- await expect(cardBadges.filter({ hasText: 'Archivé' }).locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
- await expect(restrictedIcon).toHaveAttribute('data-optical-offset-y', '0')
- await expect(accountCardBadge.locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
- await expect(cardBadges.filter({ hasText: 'Supprimé' }).locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
- await expect(cardBadges.filter({ hasText: 'Service public' }).locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
+ await expect(draftIcon).toHaveCSS('transform', 'none')
+ await expect(restrictedIcon).toHaveCSS('transform', 'none')
})
test('shows API access types with the account-only yellow tone', async ({ page }) => {
@@ -139,8 +152,8 @@ test('shows API access types with the account-only yellow tone', async ({ page }
await expect(restrictedBadge).toHaveCSS('font-weight', '500')
await expect(accountBadge.locator('svg')).toHaveCSS('width', '14px')
await expect(restrictedBadge.locator('svg')).toHaveCSS('width', '14px')
- await expect(accountBadge.locator('svg')).toHaveAttribute('data-optical-offset-y', '1')
- await expect(restrictedBadge.locator('svg')).toHaveAttribute('data-optical-offset-y', '0')
+ await expect(accountBadge.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(restrictedBadge.locator('svg')).toHaveCSS('transform', 'none')
await expect(accountBadge).not.toHaveCSS('background-color', await restrictedBadge.evaluate(element => getComputedStyle(element).backgroundColor))
})
@@ -159,10 +172,10 @@ test('shows the statuses used in tables', async ({ page }) => {
await expect(badges).toHaveCount(18)
await expect(badges.first()).toHaveCSS('min-height', '20px')
await expect(badges.first()).toHaveCSS('font-weight', '400')
- await expect(badges.first()).toHaveCSS('line-height', '16px')
+ await expect(badges.first()).toHaveCSS('line-height', '20px')
await expect(badges.first()).toHaveCSS('padding-top', '1px')
await expect(badges.first()).toHaveCSS('padding-bottom', '1px')
- await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'none')
})
test('shows the data schema badge', async ({ page }) => {
@@ -180,13 +193,13 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(tag).toHaveCSS('border-top-width', '1px')
await expect(tag).toHaveCSS('min-height', '24px')
await expect(tag).toHaveCSS('font-weight', '400')
- await expect(tag).toHaveCSS('line-height', '18px')
+ await expect(tag).toHaveCSS('line-height', '24px')
await expect(tag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
}
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
+ await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '0px')
const link = linkedTag.locator('..')
@@ -202,13 +215,13 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
await expect(selectedTags.getByRole('button')).toHaveCount(3)
await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-weight', '400')
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '18px')
+ await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '24px')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
+ await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'none')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
From 1f81ade6247e978b925b80eb89417744e8839ab8 Mon Sep 17 00:00:00 2001
From: agarrone
Date: Mon, 16 Nov 2026 11:54:48 +0100
Subject: [PATCH 26/33] fix(badges): lift compact labels optically
---
assets/css/overrides.css | 13 +++++++------
components/AdminBadge/AdminBadge.vue | 8 ++++++++
components/Datasets/DescribeDataset.vue | 2 +-
components/TagsSelect.vue | 2 +-
pages/design/tags.vue | 19 ++++++++++---------
tests/design-tags.logged-out.spec.ts | 12 ++++++++++--
6 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index b24352f1f..c600c152b 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -71,6 +71,10 @@
height: 0.875rem !important;
}
+.fr-tag > .cdata-tag__label {
+ transform: translateY(-0.0625rem);
+}
+
@layer utilities {
.cdata-tag:has(> svg:first-child) {
padding-inline-start: 0.375rem !important;
@@ -83,11 +87,7 @@
height: 0.875rem !important;
}
- /* The shared Tag currently lifts its text by 1 px; undo it locally so both
- * flex items use the same visual centre as the Design Lab proposal. */
- .cdata-tag > span.-mt-px {
- margin-top: 0 !important;
- }
+ /* The shared Tag's -1 px label offset is the optical alignment used by cdata. */
}
/*
@@ -194,7 +194,7 @@
.cdata-dataset-label-tag {
box-sizing: border-box;
min-height: 1.5rem;
- padding: 0.125rem 0.5rem !important;
+ padding: 0.0625rem 0.5rem 0.1875rem !important;
border: 1px solid var(--border-default-grey) !important;
border-radius: 999px !important;
font-size: 0.75rem !important;
@@ -221,6 +221,7 @@
height: 0.875rem;
object-fit: contain;
flex-shrink: 0;
+ transform: translateY(0.0625rem);
}
.datagouv-components .cdata-dataset-label-tag > img.bg-white {
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
index 719db3b0d..ab885c993 100644
--- a/components/AdminBadge/AdminBadge.vue
+++ b/components/AdminBadge/AdminBadge.vue
@@ -3,6 +3,7 @@
class="admin-badge inline-flex items-center"
:class="[colors, { 'whitespace-nowrap': noWrap }]"
:data-size="size"
+ :data-center-label="centerLabel || undefined"
>
(), {
noWrap: true,
+ centerLabel: false,
})
const colors = computed(() => {
@@ -88,6 +91,11 @@ const iconSize = computed(() => props.iconSize || 'size-3.5')
align-items: center;
height: 100%;
line-height: inherit;
+ transform: translateY(-0.0625rem);
+}
+
+.admin-badge[data-center-label="true"] .admin-badge__label {
+ transform: none;
}
.admin-badge__icon {
diff --git a/components/Datasets/DescribeDataset.vue b/components/Datasets/DescribeDataset.vue
index a8388df82..62ab1091f 100644
--- a/components/Datasets/DescribeDataset.vue
+++ b/components/Datasets/DescribeDataset.vue
@@ -716,7 +716,7 @@
type="button"
@click="removeZone(zone)"
>
- {{ zone.name }}
+ {{ zone.name }}
diff --git a/components/TagsSelect.vue b/components/TagsSelect.vue
index 3e81e824e..cb2d60cc9 100644
--- a/components/TagsSelect.vue
+++ b/components/TagsSelect.vue
@@ -36,7 +36,7 @@
aria-hidden="true"
focusable="false"
/>
- {{ tag.text }}
+ {{ tag.text }}
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index abf032aa8..f5b284da6 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -57,7 +57,7 @@
Tag de catégorie
+ >Tag de catégorie
- Avec icône
+ Avec icône
Cliquable · lien
+ >Cliquable · lien
- Cliquable · bouton
+ Cliquable · bouton
- Avec infobulle
+ Avec infobulle
@@ -118,7 +118,7 @@
class="size-3.5"
aria-hidden="true"
/>
- Sélectionnable
+ Sélectionnable
- Supprimable
+ Supprimable
- Désactivé
+ Désactivé
@@ -206,6 +206,7 @@
size="sm"
:type="label.type"
:icon="label.icon"
+ center-label
>
{{ label.label }}
@@ -227,7 +228,7 @@
Schéma de données
-
etalab/schema-irve
+
etalab/schema-irve
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index e017f4143..d9b0db35c 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -28,6 +28,7 @@ test('shows every compact tag state', async ({ page }) => {
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(iconTag.locator('.cdata-tag__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
await clickableTag.hover()
@@ -69,6 +70,7 @@ test('opens and closes a tag toggletip', async ({ page }) => {
expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
await expect(tag).toHaveCSS('padding-left', '6px')
await expect(tag.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(tag.locator('.cdata-tag__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
await tag.focus()
await expect(tag).toHaveCSS('outline-style', 'solid')
@@ -154,6 +156,7 @@ test('shows API access types with the account-only yellow tone', async ({ page }
await expect(restrictedBadge.locator('svg')).toHaveCSS('width', '14px')
await expect(accountBadge.locator('svg')).toHaveCSS('transform', 'none')
await expect(restrictedBadge.locator('svg')).toHaveCSS('transform', 'none')
+ await expect(accountBadge.locator('.admin-badge__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
await expect(accountBadge).not.toHaveCSS('background-color', await restrictedBadge.evaluate(element => getComputedStyle(element).backgroundColor))
})
@@ -175,7 +178,7 @@ test('shows the statuses used in tables', async ({ page }) => {
await expect(badges.first()).toHaveCSS('line-height', '20px')
await expect(badges.first()).toHaveCSS('padding-top', '1px')
await expect(badges.first()).toHaveCSS('padding-bottom', '1px')
- await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'none')
+ await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
})
test('shows the data schema badge', async ({ page }) => {
@@ -200,7 +203,7 @@ test('shows component tags with a stroke, including the linked variant', async (
await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
- await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '0px')
+ await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '-1px')
const link = linkedTag.locator('..')
const restBackground = await linkedTag.evaluate(element => getComputedStyle(element).backgroundColor)
@@ -222,6 +225,7 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'none')
+ await expect(selectedTags.getByRole('button').first().locator('.cdata-tag__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
@@ -240,6 +244,9 @@ test('shows DatasetLabelTag with and without a link', async ({ page }) => {
await expect(linkedLabel).toHaveCSS('min-height', '24px')
await expect(linkedLabel.locator('img')).toHaveCSS('width', '14px')
await expect(linkedLabel.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+ await expect(linkedLabel).toHaveCSS('padding-top', '1px')
+ await expect(linkedLabel).toHaveCSS('padding-bottom', '3px')
+ await expect(linkedLabel.locator('img')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
const restBackground = await linkedLabel.evaluate(element => getComputedStyle(element).backgroundColor)
await linkedLabel.hover()
@@ -257,6 +264,7 @@ test('shows HvdStatutBadge with and without a data URL', async ({ page }) => {
await expect(staticBadge).toHaveCSS('min-height', '20px')
await expect(staticBadge).toHaveCSS('color', await completedTableBadge.evaluate(element => getComputedStyle(element).color))
await expect(staticBadge).toHaveCSS('background-color', await completedTableBadge.evaluate(element => getComputedStyle(element).backgroundColor))
+ await expect(staticBadge.locator('.admin-badge__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
const linkedBadge = page.getByTestId('hvd-status-link').locator('a')
await expect(linkedBadge).toHaveAttribute('target', '_blank')
From dc1b2f7196d607d06b7564947a62b16e3168af9a Mon Sep 17 00:00:00 2001
From: Thibaud Ollagnier
Date: Mon, 16 Nov 2026 14:49:18 +0000
Subject: [PATCH 27/33] refactor(tags): move tag and badge styles from global
CSS into Tailwind-only Tag and AdminBadge components
---
assets/css/overrides.css | 232 -----------------
components/AccessTypes/AccessTypeBadge.vue | 2 +-
components/AdminBadge/AdminBadge.vue | 66 ++---
components/Datasets/DescribeDataset.vue | 16 +-
.../SuiviDePublication/HvdStatutBadge.vue | 2 +-
components/TagsSelect.vue | 16 +-
.../DatasetInformationSection.vue | 10 +-
.../DatasetSchemaSection.vue | 5 +-
.../src/components/DatasetLabelTag.vue | 19 +-
.../ResourceAccordion/SchemaBadge.vue | 8 +-
.../src/components/SchemaCard.vue | 6 +-
datagouv-components/src/components/Tag.vue | 58 +++--
pages/datasets/[did].vue | 1 -
pages/datasets/[did]/informations.vue | 5 +-
pages/design/tags.vue | 114 +++------
tests/datasets/[did].spec.ts | 22 --
tests/datasets/creation.spec.ts | 2 -
tests/design-tags.logged-out.spec.ts | 236 +++---------------
.../donnees-de-forte-valeur.spec.ts | 12 -
19 files changed, 162 insertions(+), 670 deletions(-)
diff --git a/assets/css/overrides.css b/assets/css/overrides.css
index c600c152b..fb92c7d30 100644
--- a/assets/css/overrides.css
+++ b/assets/css/overrides.css
@@ -34,238 +34,6 @@
@apply w-10 leading-0 text-lg;
}
-/*
- * Compact tags and interaction states owned by cdata.
- *
- * Consumer implementation of the Component Design Lab proposal. Static tags
- * stay neutral; interactive tags use DSFR action colours and selected filters
- * keep the high blue state.
- */
-.fr-tag {
- box-sizing: border-box;
- gap: 0.25rem;
- font-size: 0.75rem;
- font-weight: 400;
- line-height: 1.5rem;
- height: 1.5rem;
- min-height: 1.5rem;
- padding: 0.125rem 0.5rem;
- border: 1px solid var(--border-default-grey);
- border-radius: 0.75rem;
- color: var(--text-label-grey);
- background-color: transparent;
-}
-
-/*
- * Keep one 14 px icon frame. The text line box fills the 24 px tag and flex
- * alignment centres the icon inside that same box, without vertical offsets.
- */
-.fr-tag:has(> svg:first-child) {
- padding-inline-start: 0.375rem;
-}
-
-.fr-tag > svg:first-child {
- display: block;
- flex: none;
- width: 0.875rem !important;
- height: 0.875rem !important;
-}
-
-.fr-tag > .cdata-tag__label {
- transform: translateY(-0.0625rem);
-}
-
-@layer utilities {
- .cdata-tag:has(> svg:first-child) {
- padding-inline-start: 0.375rem !important;
- }
-
- .cdata-tag > svg:first-child {
- display: block;
- flex: none;
- width: 0.875rem !important;
- height: 0.875rem !important;
- }
-
- /* The shared Tag's -1 px label offset is the optical alignment used by cdata. */
-}
-
-/*
- * @datagouv/components-next Tag does not expose a bordered variant yet.
- * cdata adds the Design Lab stroke to its direct examples and to the tags
- * rendered by DatasetInformationSection without changing the shared package.
- */
-@layer utilities {
- .cdata-tag,
- .cdata-dataset-information .fr-raw-link > span {
- box-sizing: border-box;
- height: 1.5rem;
- min-height: 1.5rem;
- border: 1px solid var(--border-default-grey) !important;
- font-weight: 400 !important;
- line-height: 1.5rem !important;
- background-color: transparent !important;
- }
-
- .cdata-tag-link:hover > .cdata-tag,
- .cdata-tag-link:focus-visible > .cdata-tag,
- .cdata-dataset-information .fr-raw-link:hover > span,
- .cdata-dataset-information .fr-raw-link:focus-visible > span {
- color: var(--text-action-high-blue-france) !important;
- border-color: var(--border-action-high-blue-france) !important;
- background-color: var(--background-action-low-blue-france) !important;
- }
-}
-
-.cdata-tag-link:focus-visible,
-.cdata-dataset-information .fr-raw-link:focus-visible {
- border-radius: 0.75rem;
- outline: 2px solid var(--border-active-blue-france);
- outline-offset: 2px;
-}
-
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]) {
- color: var(--text-label-grey);
- background-color: transparent;
- --hover: var(--background-action-low-blue-france);
- --active: var(--background-action-low-blue-france-active);
- --hover-tint: var(--background-action-low-blue-france);
- --active-tint: var(--background-action-low-blue-france-active);
-}
-
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):focus-visible {
- color: var(--text-action-high-blue-france);
- background-color: var(--background-action-low-blue-france);
- outline: 2px solid var(--border-active-blue-france);
- outline-offset: 2px;
-}
-
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):is(:hover, :active) {
- color: var(--text-action-high-blue-france);
-}
-
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):hover {
- background-color: var(--background-action-low-blue-france) !important;
-}
-
-:is(a[href], button:not(:disabled), input[type="button"]:not(:disabled)).fr-tag:not([aria-pressed="true"]):active {
- background-color: var(--background-action-low-blue-france-active) !important;
-}
-
-:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled) {
- color: var(--text-inverted-blue-france);
- background-color: var(--background-action-high-blue-france);
- --hover: var(--background-action-high-blue-france);
- --active: var(--background-action-high-blue-france-active);
- --hover-tint: var(--background-action-high-blue-france);
- --active-tint: var(--background-action-high-blue-france-active);
-}
-
-:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled):focus-visible {
- outline: 2px solid var(--border-active-blue-france);
- outline-offset: 2px;
-}
-
-:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled),
-:is(button, input[type="button"]).fr-tag[aria-pressed="true"]:not(:disabled):hover {
- background-color: var(--background-action-high-blue-france) !important;
- background-image: none !important;
-}
-
-:is(button, input[type="button"]).fr-tag[aria-pressed="true"]::after {
- content: none !important;
-}
-
-:is(button, input[type="button"]).fr-tag:disabled {
- color: var(--text-disabled-grey);
- background-color: var(--background-disabled-grey);
- --hover: var(--background-disabled-grey);
- --active: var(--background-disabled-grey);
- --hover-tint: var(--background-disabled-grey);
- --active-tint: var(--background-disabled-grey);
-}
-
-/*
- * DatasetLabelTag belongs to @datagouv/components-next. The consumer class keeps
- * cdata's linked instance neutral at rest and preserves the SVG's native pixels.
- * `!important` is required because the package ships Tailwind in important mode.
- */
-@layer utilities {
- .cdata-dataset-label-tag {
- box-sizing: border-box;
- min-height: 1.5rem;
- padding: 0.0625rem 0.5rem 0.1875rem !important;
- border: 1px solid var(--border-default-grey) !important;
- border-radius: 999px !important;
- font-size: 0.75rem !important;
- font-weight: 400 !important;
- line-height: 1.125rem !important;
- text-transform: none !important;
- color: var(--text-label-grey) !important;
- background-color: transparent !important;
- gap: 0.25rem !important;
- }
-
- a.cdata-dataset-label-tag:hover,
- a.cdata-dataset-label-tag:focus-visible {
- color: var(--text-action-high-blue-france) !important;
- background-color: var(--background-action-low-blue-france) !important;
- }
-
- a.cdata-dataset-label-tag:active {
- background-color: var(--background-action-low-blue-france-active) !important;
- }
-
- .datagouv-components .cdata-dataset-label-tag > img {
- width: 0.875rem;
- height: 0.875rem;
- object-fit: contain;
- flex-shrink: 0;
- transform: translateY(0.0625rem);
- }
-
- .datagouv-components .cdata-dataset-label-tag > img.bg-white {
- background-color: transparent !important;
- border-radius: 0 !important;
- }
-}
-
-a.cdata-dataset-label-tag:focus-visible {
- outline: 2px solid var(--border-active-blue-france);
- outline-offset: 2px;
-}
-
-/* The business badge keeps its semantic colour; only its label is underlined. */
-.hvd-status-badge-link {
- display: inline-flex;
- border-radius: 0.25rem;
- background-color: transparent !important;
- background-image: none !important;
- --hover-tint: transparent;
- --active-tint: transparent;
-}
-
-.hvd-status-badge-link::after {
- content: none !important;
-}
-
-.hvd-status-badge-link:hover,
-.hvd-status-badge-link:active,
-.hvd-status-badge-link:focus-visible {
- background-color: transparent !important;
-}
-
-.hvd-status-badge-link:hover > span > span {
- text-decoration-line: underline;
- text-decoration-thickness: 1px;
- text-underline-offset: 2px;
-}
-
-.hvd-status-badge-link:focus-visible {
- outline: 2px solid var(--border-active-blue-france);
- outline-offset: 2px;
-}
-
/* Breadcrumb placed on a coloured hero background (OnboardingHero, EditoHeader).
Links inherit the container colour and the separator chevrons use currentColor,
so a single white colour covers the whole breadcrumb. The hero owns the
diff --git a/components/AccessTypes/AccessTypeBadge.vue b/components/AccessTypes/AccessTypeBadge.vue
index 15120c5d8..0e7c39cf3 100644
--- a/components/AccessTypes/AccessTypeBadge.vue
+++ b/components/AccessTypes/AccessTypeBadge.vue
@@ -1,6 +1,6 @@
-
+
(), {
noWrap: true,
- centerLabel: false,
+ medium: false,
})
const colors = computed(() => {
@@ -59,47 +58,12 @@ const colors = computed(() => {
}[props.type]
})
+const sizes = computed(() => {
+ return {
+ xs: 'min-h-5 py-px px-1.5 rounded-md leading-4',
+ sm: 'min-h-6 py-0.5 px-2 rounded-md leading-[18px]',
+ }[props.size]
+})
+
const iconSize = computed(() => props.iconSize || 'size-3.5')
-
-
diff --git a/components/Datasets/DescribeDataset.vue b/components/Datasets/DescribeDataset.vue
index 62ab1091f..c92cfb165 100644
--- a/components/Datasets/DescribeDataset.vue
+++ b/components/Datasets/DescribeDataset.vue
@@ -707,17 +707,17 @@
-
- {{ zone.name }}
-
+ {{ zone.name }}
+
@@ -789,8 +789,8 @@
diff --git a/pages/datasets/[did].vue b/pages/datasets/[did].vue
index c64dd4705..ec3e2da6d 100644
--- a/pages/datasets/[did].vue
+++ b/pages/datasets/[did].vue
@@ -307,7 +307,6 @@
:key="badge.kind"
:badge
:url="`/datasets/search?badge=${badge.kind}`"
- class="cdata-dataset-label-tag"
/>
diff --git a/pages/datasets/[did]/informations.vue b/pages/datasets/[did]/informations.vue
index 414bbc5e2..e17b2d61e 100644
--- a/pages/datasets/[did]/informations.vue
+++ b/pages/datasets/[did]/informations.vue
@@ -1,9 +1,6 @@
-
+
{{ $t('DOI') }}
diff --git a/pages/design/tags.vue b/pages/design/tags.vue
index f5b284da6..149e75a56 100644
--- a/pages/design/tags.vue
+++ b/pages/design/tags.vue
@@ -19,33 +19,21 @@
Tags
-
+
Mobilité
Données ouvertes
-
-
- Environnement
-
-
+ Environnement
+
@@ -54,44 +42,35 @@
États interactifs
-
Tag de catégorie
-
+ Tag de catégorie
+
+
-
- Avec icône
-
-
Cliquable · lien
-
+
+ Cliquable · lien
+
+ {}"
>
- Cliquable · bouton
-
+ Cliquable · bouton
+
-
- Avec infobulle
+ Avec infobulle
-
-
- Sélectionnable
-
-
+ {}"
>
-
- Supprimable
-
-
+ {}"
>
- Désactivé
-
+ Désactivé
+
@@ -166,7 +134,6 @@
@@ -177,7 +144,6 @@
@@ -187,7 +153,6 @@
@@ -202,11 +167,10 @@
{{ label.label }}
@@ -228,7 +192,7 @@
Schéma de données
- etalab/schema-irve
+ etalab/schema-irve
diff --git a/tests/datasets/[did].spec.ts b/tests/datasets/[did].spec.ts
index 32f3bf385..a0ea11e65 100644
--- a/tests/datasets/[did].spec.ts
+++ b/tests/datasets/[did].spec.ts
@@ -27,34 +27,12 @@ test('dataset with labels shows label section', async ({ page }) => {
// Check that labels are clickable links
await expect(labelsList.locator('a')).toHaveCount(1)
- const label = labelsList.locator('a').first()
- await expect(label).toHaveCSS('font-size', '12px')
- await expect(label).toHaveCSS('min-height', '24px')
- await expect(label.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
-
// The label text comes from the badge reference list, which the page only
// fetches for datasets that carry badges: a link with an empty label means
// that list was not loaded.
await expect(labelsList.locator('a')).toHaveText(/Service public de la donnée/)
})
-test('linked dataset labels are neutral at rest and blue on hover and focus', async ({ page }) => {
- await page.goto(
- '/datasets/base-sirene-des-entreprises-et-de-leurs-etablissements-siren-siret/',
- )
-
- const label = page.getByTestId('label-list').locator('a').first()
- const restBackground = await label.evaluate(element => getComputedStyle(element).backgroundColor)
- await label.hover()
- const hoverBackground = await label.evaluate(element => getComputedStyle(element).backgroundColor)
- expect(hoverBackground).not.toBe(restBackground)
-
- await label.focus()
- await expect(label).toBeFocused()
- await expect(label).toHaveCSS('outline-style', 'solid')
- await expect(label).toHaveCSS('outline-width', '2px')
-})
-
test('dataset labels have proper tooltips and information', async ({
page,
}) => {
diff --git a/tests/datasets/creation.spec.ts b/tests/datasets/creation.spec.ts
index 7ea0ba918..bf95d4064 100644
--- a/tests/datasets/creation.spec.ts
+++ b/tests/datasets/creation.spec.ts
@@ -132,8 +132,6 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
const selectedTags = page.getByTestId('selected-tags')
await expect(selectedTags.getByRole('button')).toHaveCount(2)
await expect(selectedTags.getByRole('button')).toHaveText(['test', 'toto'])
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
// A selected keyword is also dismissible: removing it must keep the model in sync.
await page.getByRole('button', { name: 'Supprimer le mot-clé test' }).click()
diff --git a/tests/design-tags.logged-out.spec.ts b/tests/design-tags.logged-out.spec.ts
index d9b0db35c..754919568 100644
--- a/tests/design-tags.logged-out.spec.ts
+++ b/tests/design-tags.logged-out.spec.ts
@@ -5,79 +5,43 @@ test.beforeEach(async ({ page }) => {
await gotoHydrated(page, '/design/tags')
})
-test('shows every compact tag state', async ({ page }) => {
- const staticTag = page.getByTestId('static-tag')
- const clickableTag = page.getByTestId('clickable-tag')
- const selectableTag = page.getByTestId('selectable-tag')
- const disabledTag = page.getByTestId('disabled-tag')
+// Rendering (sizes, alignment, colours) is checked on screenshots of each section, behaviour by interacting
+const screenshotOptions = { maxDiffPixelRatio: 0.01 }
- for (const tag of [staticTag, clickableTag, selectableTag, disabledTag]) {
- await expect(tag).toHaveCSS('font-size', '12px')
- await expect(tag).toHaveCSS('font-weight', '400')
- await expect(tag).toHaveCSS('line-height', '24px')
- await expect(tag).toHaveCSS('height', '24px')
- await expect(tag).toHaveCSS('min-height', '24px')
- await expect(tag).toHaveCSS('border-top-width', '1px')
+test('renders every tag and badge section', async ({ page }) => {
+ for (const section of ['components-tag-examples', 'tag-variants', 'tags-select-example', 'dataset-label-examples', 'card-business-labels', 'access-type-badges', 'schema-badge', 'table-statuses', 'hvd-status-examples']) {
+ await expect(page.getByTestId(section)).toHaveScreenshot(`${section}.png`, screenshotOptions)
}
+})
- await expect(staticTag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
- await expect(clickableTag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
+test('renders the hover and pressed states of interactive tags', async ({ page }) => {
+ const variants = page.getByTestId('tag-variants')
- const iconTag = page.getByTestId('icon-tag')
- await expect(iconTag).toHaveCSS('padding-left', '6px')
- await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
- await expect(iconTag.locator('.cdata-tag__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
+ await page.getByTestId('clickable-tag').hover()
+ await expect(variants).toHaveScreenshot('tag-variants-hover.png', screenshotOptions)
+
+ await page.getByTestId('selectable-tag').click()
+ await page.mouse.move(0, 0)
+ await expect(variants).toHaveScreenshot('tag-variants-pressed.png', screenshotOptions)
+})
- const restBackground = await clickableTag.evaluate(element => getComputedStyle(element).backgroundColor)
- await clickableTag.hover()
- await expect(clickableTag).not.toHaveCSS('background-color', restBackground)
- await clickableTag.focus()
- await expect(clickableTag).toHaveCSS('outline-style', 'solid')
+test('toggles a selectable tag', async ({ page }) => {
+ const selectableTag = page.getByTestId('selectable-tag')
+ await expect(selectableTag).toHaveAttribute('aria-pressed', 'false')
await selectableTag.click()
await expect(selectableTag).toHaveAttribute('aria-pressed', 'true')
- await expect(selectableTag.locator('svg')).toHaveCount(1)
- await expect(selectableTag.locator('svg')).toHaveCSS('width', '14px')
- await expect(selectableTag).toHaveCSS('padding-left', '6px')
- await expect(selectableTag.locator('svg')).toHaveCSS('transform', 'none')
- expect(await selectableTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
- expect(await selectableTag.evaluate(element => getComputedStyle(element, '::after').content)).toBe('none')
- const selectedBackground = await selectableTag.evaluate(element => getComputedStyle(element).backgroundColor)
- await selectableTag.hover()
- await expect(selectableTag).toHaveCSS('background-color', selectedBackground)
-
- const disabledBackground = await disabledTag.evaluate(element => getComputedStyle(element).backgroundColor)
- await disabledTag.hover()
- await expect(disabledTag).toHaveCSS('background-color', disabledBackground)
-
- const dismissibleTag = page.getByTestId('dismissible-tag')
- expect(await dismissibleTag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
- await expect(dismissibleTag).toHaveCSS('padding-left', '6px')
- const dismissibleBackground = await dismissibleTag.evaluate(element => getComputedStyle(element).backgroundColor)
- await dismissibleTag.hover()
- await expect(dismissibleTag).not.toHaveCSS('background-color', dismissibleBackground)
+ await selectableTag.click()
+ await expect(selectableTag).toHaveAttribute('aria-pressed', 'false')
})
test('opens and closes a tag toggletip', async ({ page }) => {
const tag = page.getByTestId('toggletip-tag')
const content = page.getByTestId('toggletip-tag-content')
- await expect(tag).toHaveCSS('font-size', '12px')
- await expect(tag).toHaveCSS('min-height', '24px')
- await expect(tag.locator('svg')).toHaveCount(1)
- expect(await tag.evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
- await expect(tag).toHaveCSS('padding-left', '6px')
- await expect(tag.locator('svg')).toHaveCSS('transform', 'none')
- await expect(tag.locator('.cdata-tag__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
- await tag.focus()
- await expect(tag).toHaveCSS('outline-style', 'solid')
-
await tag.click()
await expect(tag).toHaveAttribute('aria-expanded', 'true')
await expect(content).toBeVisible()
- await expect(content.locator('..').locator('..')).toHaveClass(/p-4/)
await tag.click()
await expect(tag).toHaveAttribute('aria-expanded', 'false')
@@ -86,78 +50,19 @@ test('opens and closes a tag toggletip', async ({ page }) => {
test('shows the business labels used by cards', async ({ page }) => {
const labels = page.getByTestId('card-business-labels')
- const statuses = page.getByTestId('table-statuses')
- const accessTypes = page.getByTestId('access-type-badges')
for (const text of ['Brouillon', 'Archivé', 'Accès restreint', 'Ouvert avec un compte', 'Supprimé', 'Service public']) {
await expect(labels.getByText(text, { exact: true })).toBeVisible()
}
-
- const cardBadges = labels.locator('.admin-badge')
- await expect(cardBadges).toHaveCount(6)
- await expect(cardBadges.first()).toHaveCSS('min-height', '24px')
- await expect(cardBadges.first()).toHaveCSS('font-weight', '500')
- await expect(cardBadges.first().locator('svg')).toHaveCSS('width', '14px')
- await expect(cardBadges.first()).toHaveCSS('height', '24px')
- await expect(cardBadges.first()).toHaveCSS('line-height', '24px')
- await expect(cardBadges.first().locator('.admin-badge__label')).toHaveCSS('transform', 'none')
-
- const geometry = await cardBadges.first().evaluate((element) => {
- const badge = element.getBoundingClientRect()
- const label = element.querySelector('.admin-badge__label')?.getBoundingClientRect()
- const icon = element.querySelector('svg')?.getBoundingClientRect()
- const badgeCenter = badge.top + badge.height / 2
-
- return {
- labelCenterDelta: label ? label.top + label.height / 2 - badgeCenter : null,
- iconCenterDelta: icon ? icon.top + icon.height / 2 - badgeCenter : null,
- }
- })
- expect(geometry.labelCenterDelta).toBeCloseTo(0, 5)
- expect(geometry.iconCenterDelta).toBeCloseTo(0, 5)
-
- for (const [cardLabel, tableStatus] of [['Brouillon', 'Brouillon'], ['Archivé', 'Archivé'], ['Accès restreint', 'Archivé'], ['Supprimé', 'Supprimé'], ['Service public', 'Public']]) {
- const cardBadge = cardBadges.filter({ hasText: cardLabel })
- const tableBadge = statuses.locator('.admin-badge').filter({ hasText: tableStatus }).first()
- await expect(cardBadge).toHaveCSS('color', await tableBadge.evaluate(element => getComputedStyle(element).color))
- await expect(cardBadge).toHaveCSS('background-color', await tableBadge.evaluate(element => getComputedStyle(element).backgroundColor))
- }
-
- const accountCardBadge = cardBadges.filter({ hasText: 'Ouvert avec un compte' })
- const accountAccessBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec un compte' })
- await expect(accountCardBadge).toHaveCSS('color', await accountAccessBadge.evaluate(element => getComputedStyle(element).color))
- await expect(accountCardBadge).toHaveCSS('background-color', await accountAccessBadge.evaluate(element => getComputedStyle(element).backgroundColor))
-
- const draftIcon = cardBadges.filter({ hasText: 'Brouillon' }).locator('svg')
- const restrictedIcon = cardBadges.filter({ hasText: 'Accès restreint' }).locator('svg')
- expect(await draftIcon.innerHTML()).not.toBe(await restrictedIcon.innerHTML())
- await expect(draftIcon).toHaveCSS('transform', 'none')
- await expect(restrictedIcon).toHaveCSS('transform', 'none')
})
-test('shows API access types with the account-only yellow tone', async ({ page }) => {
+test('shows API access types, with an icon only on the restricted ones', async ({ page }) => {
const accessTypes = page.getByTestId('access-type-badges')
+ const badge = (text: string | RegExp) => accessTypes.locator('span').filter({ has: page.getByText(text, { exact: true }) }).first()
- await expect(accessTypes.getByText('Ouvert', { exact: true })).toBeVisible()
- await expect(accessTypes.getByText('Ouvert avec un compte', { exact: true })).toBeVisible()
- await expect(accessTypes.getByText('Accès restreint', { exact: true })).toBeVisible()
- await expect(accessTypes.locator('.admin-badge')).toHaveCount(3)
-
- const openBadge = accessTypes.locator('.admin-badge').filter({ hasText: /^Ouvert$/ })
- const accountBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Ouvert avec un compte' })
- const restrictedBadge = accessTypes.locator('.admin-badge').filter({ hasText: 'Accès restreint' })
- await expect(openBadge.locator('svg')).toHaveCount(0)
- await expect(accountBadge.locator('svg')).toHaveCount(1)
- await expect(restrictedBadge.locator('svg')).toHaveCount(1)
- await expect(openBadge).toHaveCSS('font-weight', '500')
- await expect(accountBadge).toHaveCSS('font-weight', '500')
- await expect(restrictedBadge).toHaveCSS('font-weight', '500')
- await expect(accountBadge.locator('svg')).toHaveCSS('width', '14px')
- await expect(restrictedBadge.locator('svg')).toHaveCSS('width', '14px')
- await expect(accountBadge.locator('svg')).toHaveCSS('transform', 'none')
- await expect(restrictedBadge.locator('svg')).toHaveCSS('transform', 'none')
- await expect(accountBadge.locator('.admin-badge__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
- await expect(accountBadge).not.toHaveCSS('background-color', await restrictedBadge.evaluate(element => getComputedStyle(element).backgroundColor))
+ await expect(badge('Ouvert').locator('svg')).toHaveCount(0)
+ await expect(badge('Ouvert avec un compte').locator('svg')).toHaveCount(1)
+ await expect(badge('Accès restreint').locator('svg')).toHaveCount(1)
})
test('shows the statuses used in tables', async ({ page }) => {
@@ -170,62 +75,20 @@ test('shows the statuses used in tables', async ({ page }) => {
for (const text of ['Public', 'Brouillon', 'Archivé', 'Supprimé', 'En attente', 'En traitement', 'Terminé', 'Terminé avec des erreurs', 'Échoué', 'Inconnu', 'Pas encore contrôlé', 'Nouveau', 'Répondu', 'Clos']) {
await expect(statuses.getByText(text, { exact: true })).toBeVisible()
}
-
- const badges = statuses.locator('.admin-badge')
- await expect(badges).toHaveCount(18)
- await expect(badges.first()).toHaveCSS('min-height', '20px')
- await expect(badges.first()).toHaveCSS('font-weight', '400')
- await expect(badges.first()).toHaveCSS('line-height', '20px')
- await expect(badges.first()).toHaveCSS('padding-top', '1px')
- await expect(badges.first()).toHaveCSS('padding-bottom', '1px')
- await expect(badges.first().locator(':scope > span')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
})
test('shows the data schema badge', async ({ page }) => {
- const schema = page.getByTestId('schema-badge')
-
- await expect(schema.getByText('etalab/schema-irve', { exact: true })).toBeVisible()
+ await expect(page.getByTestId('schema-badge').getByText('etalab/schema-irve', { exact: true })).toBeVisible()
})
-test('shows component tags with a stroke, including the linked variant', async ({ page }) => {
- const staticTag = page.getByTestId('components-tag-static')
- const iconTag = page.getByTestId('components-tag-icon')
- const linkedTag = page.getByTestId('components-tag-link')
-
- for (const tag of [staticTag, iconTag, linkedTag]) {
- await expect(tag).toHaveCSS('border-top-width', '1px')
- await expect(tag).toHaveCSS('min-height', '24px')
- await expect(tag).toHaveCSS('font-weight', '400')
- await expect(tag).toHaveCSS('line-height', '24px')
- await expect(tag).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
- }
-
- await expect(iconTag.locator('svg')).toHaveCSS('width', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('height', '14px')
- await expect(iconTag.locator('svg')).toHaveCSS('transform', 'none')
- await expect(iconTag.locator(':scope > span')).toHaveCSS('margin-top', '-1px')
-
- const link = linkedTag.locator('..')
- const restBackground = await linkedTag.evaluate(element => getComputedStyle(element).backgroundColor)
- await link.hover()
- await expect(linkedTag).not.toHaveCSS('background-color', restBackground)
- await link.focus()
- await expect(link).toHaveCSS('outline-style', 'solid')
+test('links a component tag', async ({ page }) => {
+ await expect(page.getByTestId('components-tag-link')).toHaveAttribute('href', '#components-tag-examples')
+ await expect(page.getByTestId('components-tag-static')).not.toHaveAttribute('href')
})
test('shows and removes multiple TagsSelect values', async ({ page }) => {
const selectedTags = page.getByTestId('selected-tags')
await expect(selectedTags.getByRole('button')).toHaveCount(3)
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-size', '12px')
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('font-weight', '400')
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('line-height', '24px')
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('min-height', '24px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('width', '14px')
- expect(await selectedTags.getByRole('button').first().evaluate(element => element.firstElementChild?.tagName.toLowerCase())).toBe('svg')
- await expect(selectedTags.getByRole('button').first()).toHaveCSS('padding-left', '6px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('height', '14px')
- await expect(selectedTags.getByRole('button').first().locator('svg')).toHaveCSS('transform', 'none')
- await expect(selectedTags.getByRole('button').first().locator('.cdata-tag__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
await page.getByRole('button', { name: 'Supprimer le mot-clé transport' }).click()
await expect(selectedTags.getByRole('button')).toHaveCount(2)
@@ -233,50 +96,17 @@ test('shows and removes multiple TagsSelect values', async ({ page }) => {
})
test('shows DatasetLabelTag with and without a link', async ({ page }) => {
- const staticLabel = page.getByTestId('dataset-label-static')
- const linkedLabel = page.getByTestId('dataset-label-link')
-
- await expect(staticLabel).not.toHaveAttribute('href')
- await expect(linkedLabel).toHaveAttribute('href', '/datasets/search?badge=hvd')
- await expect(staticLabel).toHaveCSS('line-height', '18px')
- await expect(staticLabel).toHaveCSS('font-weight', '400')
- await expect(staticLabel).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
- await expect(linkedLabel).toHaveCSS('min-height', '24px')
- await expect(linkedLabel.locator('img')).toHaveCSS('width', '14px')
- await expect(linkedLabel.locator('img')).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
- await expect(linkedLabel).toHaveCSS('padding-top', '1px')
- await expect(linkedLabel).toHaveCSS('padding-bottom', '3px')
- await expect(linkedLabel.locator('img')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, 1)')
-
- const restBackground = await linkedLabel.evaluate(element => getComputedStyle(element).backgroundColor)
- await linkedLabel.hover()
- await expect(linkedLabel).not.toHaveCSS('background-color', restBackground)
- await linkedLabel.focus()
- await expect(linkedLabel).toHaveCSS('outline-style', 'solid')
+ await expect(page.getByTestId('dataset-label-static')).not.toHaveAttribute('href')
+ await expect(page.getByTestId('dataset-label-link')).toHaveAttribute('href', '/datasets/search?badge=hvd')
})
test('shows HvdStatutBadge with and without a data URL', async ({ page }) => {
await expect(page.getByTestId('hvd-status-empty').getByText('-', { exact: true })).toBeVisible()
+ await expect(page.getByTestId('hvd-status-static').getByRole('link')).toHaveCount(0)
- const staticBadge = page.getByTestId('hvd-status-static').locator('.admin-badge')
- const completedTableBadge = page.getByTestId('table-statuses').locator('.admin-badge').filter({ hasText: 'Terminé' }).first()
- await expect(staticBadge).toHaveCSS('text-transform', 'none')
- await expect(staticBadge).toHaveCSS('min-height', '20px')
- await expect(staticBadge).toHaveCSS('color', await completedTableBadge.evaluate(element => getComputedStyle(element).color))
- await expect(staticBadge).toHaveCSS('background-color', await completedTableBadge.evaluate(element => getComputedStyle(element).backgroundColor))
- await expect(staticBadge.locator('.admin-badge__label')).toHaveCSS('transform', 'matrix(1, 0, 0, 1, 0, -1)')
-
- const linkedBadge = page.getByTestId('hvd-status-link').locator('a')
+ const linkedBadge = page.getByTestId('hvd-status-link').getByRole('link')
await expect(linkedBadge).toHaveAttribute('target', '_blank')
await expect(linkedBadge).toHaveAttribute('rel', 'noopener noreferrer')
await expect(linkedBadge).toHaveAttribute('aria-label', /Publié.*Voir les données.*nouvel onglet/)
await expect(linkedBadge.locator('svg')).toHaveCount(1)
- await expect(linkedBadge.locator('svg')).toHaveCSS('width', '14px')
-
- const badgeBackground = await linkedBadge.locator('.admin-badge').evaluate(element => getComputedStyle(element).backgroundColor)
- await linkedBadge.hover()
- await expect(linkedBadge.locator('.admin-badge')).toHaveCSS('background-color', badgeBackground)
- await expect(linkedBadge.locator('.admin-badge > span')).toHaveCSS('text-decoration-line', 'underline')
- await linkedBadge.focus()
- await expect(linkedBadge).toHaveCSS('outline-style', 'solid')
})
diff --git a/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts b/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts
index a7801ae7a..364387d73 100644
--- a/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts
+++ b/tests/suivi-de-publication/donnees-de-forte-valeur.spec.ts
@@ -121,18 +121,6 @@ test('links the status badges to the published data', async ({ page }) => {
await expect(telechargementLink).toHaveAccessibleName('Disponible sur data.gouv.fr — Voir les données (nouvel onglet)')
await expect(telechargementLink.locator('svg')).toHaveCount(1)
await expect(telechargementLink).not.toContainText('Voir les données')
-
- const badge = telechargementLink.locator(':scope > span')
- const badgeLabel = badge.locator(':scope > span')
- const badgeBackground = await badge.evaluate(element => getComputedStyle(element).backgroundColor)
- await telechargementLink.hover()
- await expect(telechargementLink).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
- await expect(badge).toHaveCSS('background-color', badgeBackground)
- await expect(badgeLabel).toHaveCSS('text-decoration-line', 'underline')
-
- await telechargementLink.focus()
- await expect(telechargementLink).toBeFocused()
- await expect(telechargementLink).toHaveCSS('outline-width', '2px')
// "Non disponible" has no url and is not a link.
await expect(zebreRow.locator('td').nth(6).getByRole('link')).toHaveCount(0)
await expect(zebreRow.locator('td').nth(6)).toContainText('Non disponible')
From 6ee9b28d0e2dc673e7c8419fae0454e49edac31f Mon Sep 17 00:00:00 2001
From: Thibaud Ollagnier
Date: Mon, 16 Nov 2026 14:55:54 +0000
Subject: [PATCH 28/33] feat(tags): add a dismissible prop to Tag with an
accessible name built from its content
---
components/Datasets/DescribeDataset.vue | 5 ++---
components/TagsSelect.vue | 4 +---
datagouv-components/src/components/Tag.vue | 23 ++++++++++++++++------
pages/design/tags.vue | 6 ++----
tests/datasets/creation.spec.ts | 7 ++++---
tests/design-tags.logged-out.spec.ts | 2 +-
6 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/components/Datasets/DescribeDataset.vue b/components/Datasets/DescribeDataset.vue
index c92cfb165..2c3d532fb 100644
--- a/components/Datasets/DescribeDataset.vue
+++ b/components/Datasets/DescribeDataset.vue
@@ -712,8 +712,7 @@
{{ zone.name }}
@@ -790,7 +789,7 @@
diff --git a/components/AccessTypes/AccessTypePanel.vue b/components/AccessTypes/AccessTypePanel.vue
index 53f06ca04..003c1493f 100644
--- a/components/AccessTypes/AccessTypePanel.vue
+++ b/components/AccessTypes/AccessTypePanel.vue
@@ -58,8 +58,7 @@
diff --git a/components/AdminBadge/AdminBadge.vue b/components/AdminBadge/AdminBadge.vue
deleted file mode 100644
index 8708057e0..000000000
--- a/components/AdminBadge/AdminBadge.vue
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/components/AdminBadge/DataserviceBadge.vue b/components/AdminBadge/DataserviceBadge.vue
deleted file mode 100644
index 431279339..000000000
--- a/components/AdminBadge/DataserviceBadge.vue
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
- {{ status.label }}
-
-
diff --git a/components/AdminBadge/DatasetBadge.vue b/components/AdminBadge/DatasetBadge.vue
deleted file mode 100644
index f7b079dc1..000000000
--- a/components/AdminBadge/DatasetBadge.vue
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
- {{ status.label }}
-
-
diff --git a/components/AdminBadge/ReuseBadge.vue b/components/AdminBadge/ReuseBadge.vue
deleted file mode 100644
index 94ecc9fbb..000000000
--- a/components/AdminBadge/ReuseBadge.vue
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
- {{ status.label }}
-
-
diff --git a/components/AdminMembershipRequest/AdminMembershipRequest.vue b/components/AdminMembershipRequest/AdminMembershipRequest.vue
index db0af2d51..acd34c6ea 100644
--- a/components/AdminMembershipRequest/AdminMembershipRequest.vue
+++ b/components/AdminMembershipRequest/AdminMembershipRequest.vue
@@ -4,14 +4,14 @@
v-if="request.kind === 'invitation'"
class="relative bg-white shadow rounded-sm p-5 mt-3"
>
-
{{ $t('Invitation envoyée') }}
-
+
@@ -50,12 +50,11 @@
class="text-sm text-gray-medium"
>
{{ t('Rôle proposé :') }}
-
- {{ roleLabel }}
-
+
@@ -198,12 +197,12 @@
diff --git a/components/AdminTable/AdminContactPointsTable/AdminContactPointsTable.vue b/components/AdminTable/AdminContactPointsTable/AdminContactPointsTable.vue
index 86909a0c0..2258cd28b 100644
--- a/components/AdminTable/AdminContactPointsTable/AdminContactPointsTable.vue
+++ b/components/AdminTable/AdminContactPointsTable/AdminContactPointsTable.vue
@@ -33,12 +33,10 @@
{{ contactPoint.name }}
-
- {{ getRoleLabel(contactPoint) }}
-
+
{{ contactPoint.email }}
@@ -126,8 +124,8 @@
import { BrandedButton, SelectGroup, toast } from '@datagouv/components-next'
import type { ContactPoint, ContactPointRole, Organization } from '@datagouv/components-next'
import { RiPencilLine } from '@remixicon/vue'
-import AdminBadge from '~/components/AdminBadge/AdminBadge.vue'
import AdminTable from '~/components/AdminTable/Table/AdminTable.vue'
+import ContactPointRoleBadge from '~/components/ContactPoints/ContactPointRoleBadge.vue'
import AdminTableTh from '~/components/AdminTable/Table/AdminTableTh.vue'
const props = defineProps<{
diff --git a/components/AdminTable/AdminDataservicesTable/AdminDataservicesTable.vue b/components/AdminTable/AdminDataservicesTable/AdminDataservicesTable.vue
index 202fb5681..37e1e53da 100644
--- a/components/AdminTable/AdminDataservicesTable/AdminDataservicesTable.vue
+++ b/components/AdminTable/AdminDataservicesTable/AdminDataservicesTable.vue
@@ -54,6 +54,7 @@
@@ -108,14 +109,12 @@
diff --git a/components/AdminTable/AdminReusesTable/AdminReusesTable.vue b/components/AdminTable/AdminReusesTable/AdminReusesTable.vue
index 2ce637a22..21d57cc6b 100644
--- a/components/AdminTable/AdminReusesTable/AdminReusesTable.vue
+++ b/components/AdminTable/AdminReusesTable/AdminReusesTable.vue
@@ -51,7 +51,10 @@
-
+
@@ -102,14 +105,13 @@
diff --git a/components/DatasetAssignmentTable.vue b/components/DatasetAssignmentTable.vue
index fcca6da4f..ca9145d8b 100644
--- a/components/DatasetAssignmentTable.vue
+++ b/components/DatasetAssignmentTable.vue
@@ -48,7 +48,10 @@
{{ dataset.title }}
-
+
@@ -58,11 +61,10 @@
diff --git a/components/Datasets/AdminUpdateDatasetPage.vue b/components/Datasets/AdminUpdateDatasetPage.vue
index f6d1c8306..96e297b7d 100644
--- a/components/Datasets/AdminUpdateDatasetPage.vue
+++ b/components/Datasets/AdminUpdateDatasetPage.vue
@@ -121,14 +121,14 @@
>
{{ getDatasetDoi(dataset) }}
-
{{ $t('Moissonné') }}
-
+
{{ $t("Un jeu de données porteur d'un DOI ne peut plus être supprimé ni repassé en brouillon, seulement archivé.") }}
@@ -245,8 +245,9 @@
diff --git a/components/Discussions/DiscussionCommentHeader.vue b/components/Discussions/DiscussionCommentHeader.vue
index 261b8a137..c603cc434 100644
--- a/components/Discussions/DiscussionCommentHeader.vue
+++ b/components/Discussions/DiscussionCommentHeader.vue
@@ -49,18 +49,18 @@
—
-
{{ $t('Producteur') }}
-
+
diff --git a/components/Harvesters/HarvesterBadge.vue b/components/Harvesters/HarvesterBadge.vue
index 8f9d4a7c7..4661ee062 100644
--- a/components/Harvesters/HarvesterBadge.vue
+++ b/components/Harvesters/HarvesterBadge.vue
@@ -1,49 +1,49 @@
-
{{ $t('Supprimé') }}
-
-
+
{{ $t('Inactif') }}
-
-
+
{{ $t('Refusé') }}
-
-
+
{{ $t('En attente de validation') }}
-
+
-
{{ $t(`Aucun job pour l'instant`) }}
-
+
diff --git a/components/SuiviDePublication/HvdStatutBadge.vue b/components/SuiviDePublication/HvdStatutBadge.vue
index d689569a1..6fb8c21b4 100644
--- a/components/SuiviDePublication/HvdStatutBadge.vue
+++ b/components/SuiviDePublication/HvdStatutBadge.vue
@@ -1,38 +1,24 @@
-
-
-
- {{ statut }}
-
-
-
{{ statut }}
-
+
diff --git a/datagouv-components/src/components/AccessTypeBadge.vue b/datagouv-components/src/components/AccessTypeBadge.vue
new file mode 100644
index 000000000..0add04ea3
--- /dev/null
+++ b/datagouv-components/src/components/AccessTypeBadge.vue
@@ -0,0 +1,44 @@
+
+
+ {{ display.label }}
+
+
+
+
diff --git a/datagouv-components/src/components/Badge.vue b/datagouv-components/src/components/Badge.vue
new file mode 100644
index 000000000..85bef9844
--- /dev/null
+++ b/datagouv-components/src/components/Badge.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/datagouv-components/src/components/ChartBadge.vue b/datagouv-components/src/components/ChartBadge.vue
new file mode 100644
index 000000000..9aaa6cb5f
--- /dev/null
+++ b/datagouv-components/src/components/ChartBadge.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/datagouv-components/src/components/ChartCard.vue b/datagouv-components/src/components/ChartCard.vue
index 04df7db9b..141d041b0 100644
--- a/datagouv-components/src/components/ChartCard.vue
+++ b/datagouv-components/src/components/ChartCard.vue
@@ -15,22 +15,10 @@
{{ chart.title }}
-
- {{ t('Supprimé') }}
-
-
- {{ t('Brouillon') }}
-
+
+
+
+
+
diff --git a/datagouv-components/src/components/DataserviceCard.vue b/datagouv-components/src/components/DataserviceCard.vue
index 224dc0e3e..e3254d6d3 100644
--- a/datagouv-components/src/components/DataserviceCard.vue
+++ b/datagouv-components/src/components/DataserviceCard.vue
@@ -26,35 +26,17 @@
{{ dataservice.title }}
-
- {{ t('Brouillon') }}
-
-
- {{ t('Archivé') }}
-
-
- {{ t('Accès restreint') }}
-
-
- {{ t('Ouvert avec un compte') }}
-
+
+
+
+
+
+
diff --git a/datagouv-components/src/components/DatasetCard.vue b/datagouv-components/src/components/DatasetCard.vue
index fff7ca3c8..1388b3b97 100644
--- a/datagouv-components/src/components/DatasetCard.vue
+++ b/datagouv-components/src/components/DatasetCard.vue
@@ -29,21 +29,10 @@
>{{ dataset.acronym }}
-
- {{ t('Brouillon') }}
-
-
- {{ t('Archivé') }}
-
+
import type { RouteLocationRaw } from 'vue-router'
import {
- RiArchiveLine,
RiDatabase2Line,
RiDownloadLine,
RiEyeLine,
RiLineChartLine,
- RiLockLine,
RiStarLine,
} from '@remixicon/vue'
import type { Dataset, DatasetV2 } from '../types/datasets'
import type { TitleTag } from '../types/ui'
import { getDescriptionShort } from '../functions/description'
+import { getDatasetStatus } from '../functions/objectStatus'
import { useTranslation } from '../composables/useTranslation'
+import DatasetBadge from './DatasetBadge.vue'
import DatasetQualityInline from './DatasetQualityInline.vue'
import Avatar from './Avatar.vue'
import Placeholder from './Placeholder.vue'
import OrganizationLogo from './OrganizationLogo.vue'
import ObjectCard from './ObjectCard.vue'
-import ObjectCardBadge from './ObjectCardBadge.vue'
import ObjectCardMeta from './ObjectCardMeta.vue'
import ObjectCardMetric from './ObjectCardMetric.vue'
import ObjectCardMetrics from './ObjectCardMetrics.vue'
diff --git a/datagouv-components/src/components/LicenseBadge.vue b/datagouv-components/src/components/LicenseBadge.vue
index 8a1953ed1..de36f38e2 100644
--- a/datagouv-components/src/components/LicenseBadge.vue
+++ b/datagouv-components/src/components/LicenseBadge.vue
@@ -1,22 +1,16 @@
-
{{ license.title }}
-
-
- {{ license.title }}
-
+
diff --git a/datagouv-components/src/components/ObjectStatusBadge.vue b/datagouv-components/src/components/ObjectStatusBadge.vue
new file mode 100644
index 000000000..cd28c0452
--- /dev/null
+++ b/datagouv-components/src/components/ObjectStatusBadge.vue
@@ -0,0 +1,47 @@
+
+
+ {{ display.label }}
+
+
+
+
diff --git a/datagouv-components/src/components/OrganizationBadge.vue b/datagouv-components/src/components/OrganizationBadge.vue
new file mode 100644
index 000000000..76c545d78
--- /dev/null
+++ b/datagouv-components/src/components/OrganizationBadge.vue
@@ -0,0 +1,28 @@
+
+
+ {{ t('Supprimée') }}
+
+
+
+
diff --git a/datagouv-components/src/components/OrganizationTypeBadge.vue b/datagouv-components/src/components/OrganizationTypeBadge.vue
index 68c8eaafd..7d05d369a 100644
--- a/datagouv-components/src/components/OrganizationTypeBadge.vue
+++ b/datagouv-components/src/components/OrganizationTypeBadge.vue
@@ -1,17 +1,18 @@
-
{{ organizationType.label }}
-
+
diff --git a/datagouv-components/src/components/ReuseCard.vue b/datagouv-components/src/components/ReuseCard.vue
index 259b7d4d9..60463b958 100644
--- a/datagouv-components/src/components/ReuseCard.vue
+++ b/datagouv-components/src/components/ReuseCard.vue
@@ -32,23 +32,10 @@
{{ reuse.title }}
-
-
- {{ t('Brouillon') }}
-
-
- {{ t('Archivé') }}
-
-
+
diff --git a/datagouv-components/src/components/StatBox.vue b/datagouv-components/src/components/StatBox.vue
index 206dde380..1d09f4ea4 100644
--- a/datagouv-components/src/components/StatBox.vue
+++ b/datagouv-components/src/components/StatBox.vue
@@ -144,9 +144,10 @@
/>
-
+ {{ summarize(lastValue, 2) }}
@@ -156,13 +157,14 @@
:date="lastMonth"
:options="{ dateStyle: undefined, year: 'numeric', month: 'short', day: undefined }"
/>
-
+
diff --git a/pages/admin/dataservices/[id].vue b/pages/admin/dataservices/[id].vue
index b95b34344..7dcd4e940 100644
--- a/pages/admin/dataservices/[id].vue
+++ b/pages/admin/dataservices/[id].vue
@@ -37,7 +37,10 @@
{{ $t('Statut') }}:
-
+
@@ -104,10 +107,9 @@