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

Feature/accessibility #425

Merged
merged 22 commits into from
Oct 19, 2018
Merged

Feature/accessibility #425

merged 22 commits into from
Oct 19, 2018

Conversation

ElreyB
Copy link
Contributor

@ElreyB ElreyB commented Oct 10, 2018

Description

Adding accessibility to carousel

  • Adding keyboard controls
  • Reader lets you know what slide you are on
  • Slide that is being display will be read by reader

Fixes #197

Type of Change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Manually test using ChromeVox and WAVE Evaluation Tool

Checklist: (Feel free to delete this section upon completion)

  • My code follows the style guidelines of this project (I have run yarn lint)
  • New and existing unit tests pass locally with my changes (I have run yarn test and yarn test-e2e)
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@ElreyB
Copy link
Contributor Author

ElreyB commented Oct 12, 2018

@sarmeyer I was able to add some accessibility to nuka-carousel except a pause keyboard control. There are a couple of things control the autoplay which didn't alone for pause control by the keyboard. But from what I can tell everything should be good. Let me know what you think.

@ElreyB ElreyB changed the title [WIP} Feature/accessibility Feature/accessibility Oct 12, 2018
@@ -1150,7 +1150,16 @@ export default class Carousel extends React.Component {
deltaX={tx}
deltaY={ty}
>
{validChildren}
{React.Children.map(validChildren, (child, index) => {
const ariaProps =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarmeyer So I am using the same logic as before here but instead of using css {display: none} I am using {aria-hidden: true}. This way the images are still seen on the DOM keeping the look it had before but won't be read my the reader. Also, the tabbing order got messed up because I added tabindex: 1 to all the images. Now its just adding tabindex the one the is visible.

Copy link
Contributor

@jflayhart jflayhart Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarmeyer @ElreyB So I just updated to this version and narrowed down a bug to this change that is highlighted here.

On mobile iPhone devices VoiceOver correctly focuses and reads the FIRST slide, but then skips all the rest of the visible slides. Instead it goes to the next div (i.e. some other button on the page) effectively causing a11y users to miss out on all the other slides.

Any ideas on what could be causing this? It seems to be aria-hidden, because when I remove it, it works as before (used to be on 4.4.1).

@@ -477,6 +478,16 @@ export default class Carousel extends React.Component {
case 40:
this.previousSlide();
break;
case 32:
if (this.state.pauseOnHover && this.props.autoplay) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarmeyer I tested this out but since you know a little more of the use cases for the carousel let me know if it actually works.

@@ -952,8 +952,9 @@ export default class Carousel extends React.Component {
};
}

getStyleTagStyles() {
return '.slider-slide > img {width: 100%; display: block;}';
getImgTagStyles() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarmeyer For img tags the width is set to 100% thus covering the outline style for tabindex. I added a focus style so that the tab outline can be seen. This style was hard to find so I changed the function name to make it easier.

@sarmeyer sarmeyer merged commit 5e8ddce into master Oct 19, 2018
@ElreyB ElreyB deleted the feature/accessibility branch October 31, 2018 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants