Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate ids in errors and improvements tabs #879

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading