The following patch is a combination of the Composer patch from #2454351, and some bespoke code designed to add accessibility features to Owl Carousel without modifying the original library.

The accessibility code does the following:

* Defines WAI-ARIA attributes for the entire carousel widget
* Make the carousel and its individual panes focusable
* Adds keyboard events to the left/right/up/down keys to move the carousel when the carousel is focused
* Adds a description when the user focuses into the carousel
* If the carousel is set to stop on hover, stops playing on focus, and starts playing again when focus is lost
* Triggers an update every time the carousel rotates, in order for screen readers to read out the current content of the carousel

I've had a functional methodology in mind when designing the accessibility code, and have chosen to implement it using the mindset that it's a "glue" layer on top of Owl Carousel, instead of modifying the original code. This sort of approach might allow us to add extra functionality in the same sort of way, allowing us to do things like configurable thumbnails, custom behaviour, etc.

Before people start running off to use this in production, keep in mind that it has not yet undergone formal accessibility review, so it's probably not ready for use in situations while it really matters. Also, while WAI-ARIA attributes have been implemented, keep in mind that browser support for them (unfortunately) remains variable.
Furthermore, I've had some problems with it being a bit crashy on Chrome (to my endless frustration), but it seems to behave pretty well in other browsers, particularly Firefox.
Finally, I get the feeling that this issue might open up more tins of worms as far as extending Owl Carousel goes.

Let me know what you think; this goes for Owl Carousel 2.x users too.

CommentFileSizeAuthor
owlcarousel-7.x-1.x-dev-a11y.patch18.16 KBgeoffreyr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mgifford’s picture

I couldn't apply that patch here http://simplytest.me/project/owlcarousel/7.x-1.x?patch[]=https://www.dru...

I don't use this carousel though...

NWOM’s picture

Status: Needs review » Needs work

Thank you for the patch. However sadly it does not apply to the 7.x-1.x-dev or to the 7.x-2.x-dev. I tried to manually patch it, but it appears numerous things have changed in the last 3 years which makes it hard for me to patch it myself.

Anyone able to potentially reroll the patch? Thanks in advance!

geoffreyr’s picture

It has been a while, hasn't it. I might see if I can reroll it and #2454351.

NWOM’s picture

Thank you. It'd be definitely great to have those accessibility options.

ipwa’s picture

Hi @geoffreyr I am one of the maintainers and I'm interested in getting this in. If you reroll I promise to do a reviews straight away.