-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added focus styles for interactive elements #576
Changes from all commits
a2ff8e9
a349e9c
88e967c
2671565
3281524
625bcb9
cf15ee4
bfdedef
ca17d3f
0c6794e
1902bc5
a69bec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,7 +251,7 @@ export const SliderBlock = (props: WithChildren<SliderProps>) => { | |
return ( | ||
// To have this key differ from keys used in renderDot function, added `-accessible-bar` part | ||
<Fragment key={`${index}-accessible-bar`}> | ||
{slidesCountByBreakpoint > 1 && ( | ||
{slidesCountByBreakpoint > 0 && ( | ||
<li | ||
className={b('accessible-bar')} | ||
aria-current | ||
|
@@ -266,8 +266,9 @@ export const SliderBlock = (props: WithChildren<SliderProps>) => { | |
); | ||
}; | ||
|
||
const renderDot = (index: number) => { | ||
const getCurrentSlideNumber = (index: number) => { | ||
const currentIndexDiff = index - currentIndex; | ||
|
||
let currentSlideNumber; | ||
if (0 <= currentIndexDiff && currentIndexDiff < slidesToShowCount) { | ||
currentSlideNumber = currentIndex + 1; | ||
|
@@ -276,19 +277,26 @@ export const SliderBlock = (props: WithChildren<SliderProps>) => { | |
} else { | ||
currentSlideNumber = index + 1; | ||
} | ||
return currentSlideNumber; | ||
}; | ||
const isVisibleSlide = (index: number) => { | ||
const currentIndexDiff = index - currentIndex; | ||
|
||
return ( | ||
slidesCountByBreakpoint > 0 && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something wrong with a slider. I can tab trough cards and then if I click to the arrow it doesn't work right There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, this is an issue I think came from react-slick, I didn't manage to find a solution better than wrap each slide with |
||
0 <= currentIndexDiff && | ||
currentIndexDiff < slidesToShowCount | ||
); | ||
}; | ||
|
||
const renderDot = (index: number) => { | ||
return ( | ||
<li | ||
key={index} | ||
className={b('dot', {active: index === currentIndex})} | ||
onClick={() => handleDotClick(index)} | ||
aria-hidden={ | ||
(slidesCountByBreakpoint > 1 && | ||
0 <= currentIndexDiff && | ||
currentIndexDiff < slidesToShowCount) || | ||
undefined | ||
} | ||
aria-label={`Slide ${currentSlideNumber} of ${barSlidesCount}`} | ||
aria-hidden={isVisibleSlide(index) ? true : undefined} | ||
aria-label={`Slide ${getCurrentSlideNumber(index)} of ${barSlidesCount}`} | ||
></li> | ||
); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change the value? Could it break something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it because when we have
slidesCountByBreakpoint === 1
the accessible bar didn't render and one was unable to find it vis screenreader