Skip to content

Commit 4e7bd77

Browse files
authored
Merge pull request #1055 from CopperGiraffe/fix-id-datatable
fix: 🐛 Ajout d’unicité sur les IDs d’un composant DataTable
2 parents 07ee0d6 + 4057f0d commit 4e7bd77

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/components/DsfrDataTable/DsfrDataTable.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export type DsfrDataTableProps = {
3232
pages?: Page[]
3333
pagination?: boolean
3434
paginationOptions?: number[]
35+
paginationAriaLabel?: string
3536
currentPage?: number
3637
rowsPerPage?: number
3738
bottomActionBarClass?: string | Record<string, boolean> | Array<string | Record<string, boolean>>
@@ -50,6 +51,7 @@ const props = withDefaults(defineProps<DsfrDataTableProps>(), {
5051
10,
5152
20,
5253
],
54+
paginationAriaLabel: 'Pagination',
5355
})
5456
5557
const emit = defineEmits<{
@@ -280,12 +282,12 @@ function copyToClipboard (text: string) {
280282
<div class="flex gap-2 items-center">
281283
<label
282284
class="fr-label"
283-
for="pagination-options"
285+
:for="`${id}-pagination-options`"
284286
>
285287
Résultats par page :
286288
</label>
287289
<select
288-
id="pagination-options"
290+
:id="`${id}-pagination-options`"
289291
v-model="rowsPerPage"
290292
class="fr-select"
291293
@change="onPaginationOptionsChange()"
@@ -314,6 +316,7 @@ function copyToClipboard (text: string) {
314316
<DsfrPagination
315317
v-model:current-page="currentPage"
316318
:pages="pages"
319+
:aria-label="paginationAriaLabel"
317320
@update:current-page="selection.length = 0"
318321
/>
319322
</div>

src/components/DsfrPagination/DsfrPagination.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export type DsfrPaginationProps = {
88
nextPageTitle?: string
99
prevPageTitle?: string
1010
truncLimit?: number
11+
ariaLabel?: string
1112
}

src/components/DsfrPagination/DsfrPagination.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const props = withDefaults(defineProps<DsfrPaginationProps>(), {
1212
lastPageTitle: 'Dernière page',
1313
nextPageTitle: 'Page suivante',
1414
prevPageTitle: 'Page précédente',
15+
ariaLabel: 'Pagination',
1516
})
1617
1718
const emit = defineEmits<{ (e: 'update:current-page', payload: number): void }>()
@@ -39,7 +40,7 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
3940
<nav
4041
role="navigation"
4142
class="fr-pagination"
42-
aria-label="Pagination"
43+
:aria-label="ariaLabel"
4344
>
4445
<ul class="fr-pagination__list">
4546
<li>

0 commit comments

Comments
 (0)