Skip to content

Commit

Permalink
fix(Pagination): only add role link to disabled anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
francinelucca committed Sep 16, 2024
1 parent 311f98d commit cca5a45
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/react/src/Pagination/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,13 @@ export function buildComponentData(
key = 'page-prev'
content = 'Previous'
if (page.disabled) {
Object.assign(props, {'aria-disabled': 'true'})
Object.assign(props, {'aria-disabled': 'true', role: 'link'})
} else {
Object.assign(props, {
rel: 'prev',
href: hrefBuilder(page.num),
'aria-label': 'Previous Page',
onClick,
role: 'link',
})
}
break
Expand All @@ -164,14 +163,13 @@ export function buildComponentData(
key = 'page-next'
content = 'Next'
if (page.disabled) {
Object.assign(props, {'aria-disabled': 'true'})
Object.assign(props, {'aria-disabled': 'true', role: 'link'})
} else {
Object.assign(props, {
rel: 'next',
href: hrefBuilder(page.num),
'aria-label': 'Next Page',
onClick,
role: 'link',
})
}
break
Expand All @@ -187,7 +185,6 @@ export function buildComponentData(
'aria-label': `Page ${page.num}${page.precedesBreak ? '...' : ''}`,
onClick,
'aria-current': page.selected ? 'page' : undefined,
role: 'link',
})
break
}
Expand Down

0 comments on commit cca5a45

Please sign in to comment.