@@ -38,6 +38,19 @@ const toPreviousPage = () => toPage(Math.max(0, props.currentPage - 1))
3838const toNextPage = () => toPage (Math .min (props .pages .length - 1 , props .currentPage + 1 ))
3939const toLastPage = () => toPage (props .pages .length - 1 )
4040const isCurrentPage = (page : Page ) => props .pages .indexOf (page ) === props .currentPage
41+ const pageTitle = (page : Page ) => {
42+ if (isCurrentPage (page ) && page .title ) {
43+ if (props .currentPageTitleSuffix ) {
44+ return ` ${page .title }${props .currentPageTitleSuffix } `
45+ }
46+
47+ if (page .label !== page .title ) {
48+ return page .title
49+ }
50+ }
51+
52+ return undefined
53+ }
4154 </script >
4255
4356<template >
@@ -52,7 +65,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
5265 :href =" pages[0]?.href"
5366 class =" fr-pagination__link fr-pagination__link--first"
5467 :class =" { 'fr-pagination__link--disabled': currentPage === 0 }"
55- :title =" firstPageTitle"
5668 :aria-disabled =" currentPage === 0 ? true : undefined"
5769 @click.prevent =" currentPage === 0 ? null : tofirstPage()"
5870 >
@@ -64,7 +76,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
6476 :href =" pages[Math.max(currentPage - 1, 0)]?.href"
6577 class =" fr-pagination__link fr-pagination__link--prev fr-pagination__link--lg-label"
6678 :class =" { 'fr-pagination__link--disabled': currentPage === 0 }"
67- :title =" prevPageTitle"
6879 :aria-disabled =" currentPage === 0 ? true : undefined"
6980 @click.prevent =" currentPage === 0 ? null : toPreviousPage()"
7081 >{{ prevPageTitle }}</a >
@@ -79,7 +90,7 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
7990 <a
8091 :href =" page?.href"
8192 class =" fr-pagination__link fr-unhidden-lg"
82- :title =" (isCurrentPage( page) && page.title) ? (currentPageTitleSuffix) ? page.title + currentPageTitleSuffix : page.title : (page.title !== page.label) ? page.title : undefined "
93+ :title =" pageTitle( page)"
8394 :aria-current =" isCurrentPage(page) ? 'page' : undefined"
8495 @click.prevent =" toPage(pages.indexOf(page))"
8596 >
@@ -103,7 +114,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
103114 :href =" pages[Math.min(currentPage + 1, pages.length - 1)]?.href"
104115 class =" fr-pagination__link fr-pagination__link--next fr-pagination__link--lg-label"
105116 :class =" { 'fr-pagination__link--disabled': currentPage === pages.length - 1 }"
106- :title =" nextPageTitle"
107117 :disabled =" currentPage === pages.length - 1 ? true : undefined"
108118 :aria-disabled =" currentPage === pages.length - 1 ? true : undefined"
109119 @click.prevent =" currentPage === pages.length - 1 ? null : toNextPage()"
@@ -114,7 +124,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
114124 :href =" pages.at(-1)?.href"
115125 class =" fr-pagination__link fr-pagination__link--last"
116126 :class =" { 'fr-pagination__link--disabled': currentPage === pages.length - 1 }"
117- :title =" lastPageTitle"
118127 :disabled =" currentPage === pages.length - 1 ? true : undefined"
119128 :aria-disabled =" currentPage === pages.length - 1 ? true : undefined"
120129 @click.prevent =" currentPage === pages.length - 1 ? null : toLastPage()"
@@ -129,8 +138,8 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
129138<style scoped>
130139.fr-pagination__link :hover {
131140 background-image : linear-gradient (
132- deg, rgba (224 ,224 ,224 ,0.5 ), rgba (224 ,224 ,224 ,0.5 ));
133- }
141+ deg, rgba (224 ,224 ,224 ,0.5 ), rgba (224 ,224 ,224 ,0.5 ));
142+ }
134143.fr-pagination__link--disabled {
135144 color : currentColor ;
136145 cursor : not-allowed ;
0 commit comments