Skip to content

Commit

Permalink
Improve BannerSlider UX and accessibility (Won-Games#67)
Browse files Browse the repository at this point in the history
* Fix hidden Banner focusable on BannerSlider

* Improve BannerSlider slick dots UX  to show focus
  • Loading branch information
Lukazovic authored Aug 20, 2021
1 parent d081898 commit c1fc717
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/components/BannerSlider/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ export const Wrapper = styled.section`
justify-content: center;
margin: 0 ${theme.spacings.xxsmall};
cursor: pointer;
transition: box-shadow ${theme.transition.default};
&.slick-active {
background: ${theme.colors.primary};
}
&:focus-within {
box-shadow: 0 0 0 0.3rem ${theme.colors.secondary};
}
}
button {
Expand All @@ -35,6 +40,14 @@ export const Wrapper = styled.section`
}
}
.slick-slide {
visibility: hidden;
&.slick-active.slick-current {
visibility: visible;
}
}
${media.greaterThan('large')`
${BannerStyles.Wrapper} {
max-width: 104rem;
Expand Down
4 changes: 2 additions & 2 deletions src/components/BannerSlider/test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('<BannerSlider />', () => {
).toBeInTheDocument()

expect(
screen.getByRole('heading', { name: /defy death 2/i, hidden: true })
).toBeInTheDocument()
screen.queryByRole('heading', { name: /defy death 2/i, hidden: true })
).not.toBeInTheDocument()
})

it('should render with the dots', () => {
Expand Down

0 comments on commit c1fc717

Please sign in to comment.