Skip to content

Commit

Permalink
Fix duplicate ids in errors and improvements tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
yaaax committed Nov 15, 2024
1 parent 068379e commit 20a9b04
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
19 changes: 12 additions & 7 deletions confiture-web-app/src/components/report/ReportCriteria.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ReportImprovement } from "./getReportImprovements";
defineProps<{
count: number;
pagesData: ReportError[] | ReportImprovement[];
tabSlug: string;
transverseData: ReportError | ReportImprovement;
showFilters?: boolean;
topNotice?: string;
Expand Down Expand Up @@ -36,12 +37,12 @@ const hasFilters = computed(() => {
<button
class="fr-sidemenu__btn"
hidden
aria-controls="fr-sidemenu-wrapper"
:aria-controls="`report-${tabSlug}_sidemenu-wrapper`"
aria-expanded="false"
>
Pages
</button>
<div id="fr-sidemenu-wrapper" class="fr-collapse">
<div :id="`report-${tabSlug}_sidemenu-wrapper`" class="fr-collapse">
<div class="fr-sidemenu__title fr-mb-2w">Pages</div>
<ul class="fr-sidemenu__list">
<li
Expand All @@ -56,10 +57,10 @@ const hasFilters = computed(() => {
>
<a
class="fr-sidemenu__link"
href="#elements-transverses"
:href="`#${tabSlug}_elements-transverses`"
:aria-current="
route.hash
? isActive('#elements-transverses')
? isActive(`#${tabSlug}_elements-transverses`)
? 'true'
: undefined
: 'true'
Expand All @@ -72,13 +73,17 @@ const hasFilters = computed(() => {
:key="page.name"
class="fr-sidemenu__item"
:class="{
'fr-sidemenu__item--active': isActive(`#${page.id}`)
'fr-sidemenu__item--active': isActive(
`#${tabSlug}_${page.id}`
)
}"
>
<a
class="fr-sidemenu__link"
:href="`#${page.id}`"
:aria-current="isActive(`#${page.id}`) ? 'true' : undefined"
:href="`#${tabSlug}_${page.id}`"
:aria-current="
isActive(`#${tabSlug}_${page.id}`) ? 'true' : undefined
"
>
{{ page.name }}
</a>
Expand Down
5 changes: 3 additions & 2 deletions confiture-web-app/src/components/report/ReportErrors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function resetFilters() {
:pages-data="pagesErrors"
:transverse-data="transverseErrors"
:show-filters="true"
tab-slug="errors"
>
<template #filter>
<div class="fr-text--bold fr-text--xl fr-mb-2w filter-title">Filtres</div>
Expand Down Expand Up @@ -198,7 +199,7 @@ function resetFilters() {

<template v-if="transverseErrors.topics.length" #transverse-data>
<section class="fr-mb-8w">
<h2 id="elements-transverses" class="fr-h3 fr-mb-2w page-title">
<h2 id="errors_elements-transverses" class="fr-h3 fr-mb-2w page-title">
Éléments transverses
</h2>

Expand All @@ -223,7 +224,7 @@ function resetFilters() {

<template #pages-data>
<section v-for="page in pagesErrors" :key="page.id" class="fr-mb-8w">
<h2 :id="`${page.id}`" class="fr-h3 fr-mb-2w page-title">
<h2 :id="`errors_${page.id}`" class="fr-h3 fr-mb-2w page-title">
{{ page.name }}
</h2>
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ const improvementsCount = computed(() => {
top-notice="Ci-dessous les commentaires de l’auditeur ou de l’auditrice concernant des critères conformes ou non applicables."
:count="improvementsCount"
:pages-data="pagesImprovements"
tab-slug="improvements"
:transverse-data="transverseImprovements"
>
<template #transverse-data>
<section class="fr-mb-8w">
<h2 id="elements-transverses" class="fr-h3 fr-mb-2w page-title">
<h2
id="improvements_elements-transverses"
class="fr-h3 fr-mb-2w page-title"
>
Éléments transverses
</h2>

Expand Down Expand Up @@ -65,7 +69,7 @@ const improvementsCount = computed(() => {
:key="page.id"
class="fr-mb-8w"
>
<h2 :id="`${page.id}`" class="fr-h3 fr-mb-2w page-title">
<h2 :id="`improvements_${page.id}`" class="fr-h3 fr-mb-2w page-title">
{{ page.name }}
</h2>
<a
Expand Down

0 comments on commit 20a9b04

Please sign in to comment.