Code Monkey home page Code Monkey logo

accessible-carousel-boilerplates's Introduction

Accessible carousel boilerplates

Carousels aren't effective or popular with real users, but sometimes you just have no choice! At Accessible360, we see carousels on client sites every day, and we've found them to be a common source of accessibility barriers practically every time they are used.

To help make a difference for end users and developers sooner rather than later, we're releasing this set of realistic, ready-to-use code snippets for popular carousel packages that you can start using right now to create more accessible carousels and sliders! So far we have snippets for:

If you'd like to see snippets for other carousel packages or use cases, please let us know!

All of these code snippets can also be found over on CodePen in this collection (they are exactly the same!).

accessible-slick

accessible-slick is a drop-in replacement for the classic Slick Slider package that adds a layer of built-in accessibility improvements. Since practically all of its accessibility improvements are baked right into the package, these code snippets end up being the smallest and simplest.

Flickity

Flickity has some good things going for it, but also a few major issues for accessibility. Avoid using the wrapAround and accessibility options, and be sure to hide all the interactive content inside of each slide.

Owl Carousel 2

Owl Carousel 2 is officially deprecated and should not be used for new projects! Avoid using the inaccessible built-in slide dots, and be sure to use the events API to hide all non-visible slides.

Slick Slider

Slick Slider is perhaps the most widely-used carousel package, even though it has been abandoned (though not officially deprecated) by its author. Ironically, you should avoid the accessibility option, since it actually makes the markup worse for disabled users! Be sure to use the latest version (1.8.1 as of May 2021), which includes some important updates that affect accessibility. Custom JavaScript will be needed to ensure that non-visible slides are actually hidden.

Splide

Splide may be the most accessible package of all of these, with good use of semantic HTML. Avoid the keyboard and slideFocus options. Some minor work needs to be done to ensure that non-visible slides are fully hidden.


Credits

The research and code snippets provided in this article were made by Accessible360, whose expert accessibility engineers were invaluable in providing their insight, feedback, and time on this topic.

If your company is looking for an accessibility partner to help bring your product to the next level through live user audits, monitoring, training, or remediation support, then get in touch today!

Visit Accessible360.com

accessible-carousel-boilerplates's People

Contributors

giorgosk avatar jasonwebb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

accessible-carousel-boilerplates's Issues

Splide: resume autoplay not firing

Pause is working, resuming to play not working.

https://accessible360.github.io/accessible-carousel-boilerplates/Splide/hero-banner.html

The problem is in the function toggleAutoplay() where you look for splide option autoplay, which always returns true. You have to overide this option in if statement. See example bellow.

function toggleAutoplay() {
    var autoplayEnabled = splide.options.autoplay;

    if (autoplayEnabled) {
        disableAutoplay();
        splide.options = { autoplay: false }; // <-- this is missing
    } else {
        enableAutoplay();
        splide.options = { autoplay: true }; // <-- this is missing
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.