Skip to content

Commit 212714c

Browse files
langermankjonrohan
andauthored
Add focus styles to Pagination component (#5082)
* lil bug fix * Create large-glasses-provide.md --------- Co-authored-by: Jon Rohan <[email protected]>
1 parent 8385c33 commit 212714c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Add focus styles to Pagination component

packages/react/src/Pagination/Pagination.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Box from '../Box'
44
import {get} from '../constants'
55
import type {SxProp} from '../sx'
66
import sx from '../sx'
7-
import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles'
87
import {buildComponentData, buildPaginationModel} from './model'
98
import type {ResponsiveValue} from '../hooks/useResponsiveValue'
109
import {viewportRanges} from '../hooks/useResponsiveValue'
@@ -56,7 +55,10 @@ const Page = styled.a`
5655
transition-duration: 0.1s;
5756
}
5857
59-
${getGlobalFocusStyles(0)};
58+
&:focus-visible {
59+
outline: 2px solid ${get('colors.accent.emphasis')};
60+
outline-offset: -2px;
61+
}
6062
6163
&:active {
6264
border-color: ${get('colors.border.muted')};
@@ -74,6 +76,12 @@ const Page = styled.a`
7476
border-color: transparent;
7577
}
7678
79+
&[aria-current]:focus-visible {
80+
outline: 2px solid ${get('colors.accent.emphasis')};
81+
outline-offset: -2px;
82+
box-shadow: inset 0 0 0 3px ${get('colors.fg.onEmphasis')};
83+
}
84+
7785
&[aria-disabled],
7886
&[aria-disabled]:hover {
7987
margin: 0 2px;
@@ -196,7 +204,7 @@ const PaginationContainer = styled.nav<SxProp>`
196204
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:first-child {
197205
margin-inline-end: 0;
198206
}
199-
207+
200208
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:last-child {
201209
margin-inline-start: 0;
202210
}

0 commit comments

Comments
 (0)