Skip to content
Open
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions src/macro-carousel/macro-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1145,15 +1145,15 @@ value. Add CSS units to its value to avoid breaking the slides layout.`);
let isSlideInView;
this._slides.map(slide => slide.element).forEach((slideEl, slideIndex) => {
isSlideInView = !isUndefined(slidesInView.find(i => i === slideIndex));
// Slides in view have `aria-hidden` set to `false`.

// Ensure DOM is not accessible unless it is in the view.
slideEl.inert = !isSlideInView;
slideEl.setAttribute(ATTRS.STANDARD.ARIA.HIDDEN,
isSlideInView ? ATTR_VALUES.FALSE : ATTR_VALUES.TRUE);

// Slides in view don't have the `inert` attribute and can be focused.
if (isSlideInView) {
slideEl.removeAttribute(ATTRS.STANDARD.INERT);
slideEl.setAttribute(ATTRS.STANDARD.TABINDEX, -1);
} else {
slideEl.setAttribute(ATTRS.STANDARD.INERT, '');
slideEl.setAttribute(ATTRS.STANDARD.TABINDEX, '-1');
Copy link
Owner

Choose a reason for hiding this comment

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

Judging at the comment just before the if, it looks like I left a bug in those lines.
I think, if isSlideInView is true, the tabindex attribute should be removed (instead of being set to -1)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think its currently working as intended, we want to give tabindex -1 so we can programmatically focus the slide right?

https://mzl.la/2LY933V
Screenshot 2019-10-08 at 18 01 48

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wicg-inert seems to do some magic with tabindex too.. 😕

}
});
}
Expand Down