Skip to content

Commit

Permalink
Add focus styles to Pagination component (#5082)
Browse files Browse the repository at this point in the history
* lil bug fix

* Create large-glasses-provide.md

---------

Co-authored-by: Jon Rohan <yes@jonrohan.codes>
  • Loading branch information
langermank and jonrohan authored Oct 8, 2024
1 parent 8385c33 commit 212714c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-glasses-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Add focus styles to Pagination component
14 changes: 11 additions & 3 deletions packages/react/src/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Box from '../Box'
import {get} from '../constants'
import type {SxProp} from '../sx'
import sx from '../sx'
import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles'
import {buildComponentData, buildPaginationModel} from './model'
import type {ResponsiveValue} from '../hooks/useResponsiveValue'
import {viewportRanges} from '../hooks/useResponsiveValue'
Expand Down Expand Up @@ -56,7 +55,10 @@ const Page = styled.a`
transition-duration: 0.1s;
}
${getGlobalFocusStyles(0)};
&:focus-visible {
outline: 2px solid ${get('colors.accent.emphasis')};
outline-offset: -2px;
}
&:active {
border-color: ${get('colors.border.muted')};
Expand All @@ -74,6 +76,12 @@ const Page = styled.a`
border-color: transparent;
}
&[aria-current]:focus-visible {
outline: 2px solid ${get('colors.accent.emphasis')};
outline-offset: -2px;
box-shadow: inset 0 0 0 3px ${get('colors.fg.onEmphasis')};
}
&[aria-disabled],
&[aria-disabled]:hover {
margin: 0 2px;
Expand Down Expand Up @@ -196,7 +204,7 @@ const PaginationContainer = styled.nav<SxProp>`
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:first-child {
margin-inline-end: 0;
}
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:last-child {
margin-inline-start: 0;
}
Expand Down

0 comments on commit 212714c

Please sign in to comment.