Skip to content
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(slider): changed the properties that were generating an error in… #115

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Fixed the accessibility issue of the `aria-controls`s' relationship between the slider and its controls ([reference](https://dequeuniversity.com/rules/axe/4.7/aria-valid-attr-value)).
- Fixed the `tabindex` accessibility issue of the dots controls ([reference](https://dequeuniversity.com/rules/axe/4.7/tabindex)).

## [0.24.3] - 2023-05-08

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion react/components/PaginationDots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const PaginationDots: FC<Props> = ({ controls, totalItems, infinite }) => {
width: `${DOTS_DEFAULT_SIZE}rem`,
}}
key={index}
tabIndex={index}
tabIndex={isActive ? 0 : -1}
onKeyDown={event => handleDotClick(event, index)}
onClick={event => handleDotClick(event, index)}
role="button"
Expand Down
5 changes: 4 additions & 1 deletion react/components/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const Slider: FC<Props> = ({
const controls = `${label
.toLowerCase()
.trim()
.replace(/ /g, '-')}-items`
.replace(/ /g, '-')}-items-${Math.random()
.toString(36)
.substring(2, 9)}`

const shouldShowArrows = Boolean(
(showNavigationArrows === 'always' ||
Expand Down Expand Up @@ -98,6 +100,7 @@ const Slider: FC<Props> = ({
onTouchEnd={touchEndHandler}
onTouchMove={touchMoveHandler}
aria-label={label}
id={controls}
style={{
WebkitOverflowScrolling: !shouldUsePagination ? 'touch' : undefined,
paddingLeft: fullWidth ? undefined : arrowSize * 2,
Expand Down
Loading