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

Carousel #6295

Merged
merged 7 commits into from Nov 22, 2016
Merged

Carousel #6295

merged 7 commits into from Nov 22, 2016

Conversation

chenshay
Copy link
Contributor

Visible slides that are out of view need an aria-hidden.

close #5484

@@ -467,8 +467,12 @@ export class AmpSlideScroll extends BaseSlides {
if (showIndex == newIndex) {
this.scheduleLayout(this.slides_[showIndex]);
this.scheduleResume(this.slides_[showIndex]);
this.slides_[showIndex] &&
Copy link
Contributor

Choose a reason for hiding this comment

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

you dont have to check for this. Show index is promised to exist at this point

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

} else {
this.schedulePreload(this.slides_[showIndex]);
this.slides_[showIndex] &&
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -515,6 +519,8 @@ export class AmpSlideScroll extends BaseSlides {
setStyle(this.slideWrappers_[i], 'order', '');
}
this.slideWrappers_[i].classList.remove(SHOWN_CSS_CLASS);
this.slides_[i] &&
this.slides_[i].setAttribute('aria-hidden', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

these are display none so aria-hidden is not needed here.

Copy link
Contributor

@aghassemi aghassemi Nov 22, 2016

Choose a reason for hiding this comment

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

@camelburrito We need this here otherwise we can get to a conflicting state where display:none but aria-hidden=false (this can happens if one jumps more than 2 slides, although not something that UI supports yet, it is something that can happen when we do amp-bind)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 to what @aghassemi said.

@@ -515,6 +517,7 @@ export class AmpSlideScroll extends BaseSlides {
setStyle(this.slideWrappers_[i], 'order', '');
}
this.slideWrappers_[i].classList.remove(SHOWN_CSS_CLASS);
this.slides_[i].setAttribute('aria-hidden', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

should we removeAttribute here and let the browser take care of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aghassemi - WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM. End result is the same,removeAttribute is a faster DOM operation than setAttribute anyway.

@camelburrito camelburrito merged commit b0a2eeb into ampproject:master Nov 22, 2016
@chenshay chenshay deleted the carousel branch November 22, 2016 22:50
@chenshay chenshay added the LGTM label Nov 22, 2016
Lith pushed a commit to Lith/amphtml that referenced this pull request Dec 22, 2016
* revert change 4089

* set ariane-hidden to visible elements out of view

* remove checks

* removing aria-hidden
Lith pushed a commit to Lith/amphtml that referenced this pull request Dec 22, 2016
* revert change 4089

* set ariane-hidden to visible elements out of view

* remove checks

* removing aria-hidden
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.

[A11Y] Slides carousel: The preloaded slides need aria-hidden
3 participants