KATC is a highly configurable carousel widget, intended for lists of thumbnails. When called against a list of hyperlink-wrapped images, this plugin progressively enhances the list to a keyboard-accessible, infinitely looping, carousel.
Whenever a focusable element within the widget has the focus, the arrow keys may be used to rotate the carousel. Unplug your mouse and try it!
Why Another Carousel?
In contrast to other carousels and slider widgets, the item(s) in view may be given the focus via the keyboard.
This makes KATC especially useful for when several thumbnails are in view and clicking on a thumbnail results in a larger version of the image being shown. While this UI pattern is common with carousels, it's frequently limited to mouse use.
Keyboard accessibility is important to many users, including those with motor impairments and hand tremors.
KATC is even fully keyboard accessible in Opera!
Code Playground
jump to result (Unlike KATC itself the code editors are not keyboard accessible as they trap the focus.)
Keyboard-related Behaviour Of KATC
Providing keyboard access for a carousel widget throws up a number of interesting complications and design decisions. Below is the list of tests used to check that the behaviour of KATC is in accordance with the design decisions taken. "jump-to button" refers to the buttons that provide random access to the sets of items that the carousel displays.
- K1 Pressing the left arrow key when any element within the widget has the focus should slide the currently displayed items(s) to the right and the left arrow button should receive the focus; pressing the right arrow key when any element within the widget has the focus should slide the currently displayed items(s) to the left and the right arrow key should receive the focus.
- K2 The focusable elements within the widget should follow the natural tab order. For example, pressing the tab key when the left arrow button has the focus should mean the first of the items in the currently displayed morsel receives the focus.
- K3 While a rotation animation is on progress, the rotated items should not be able to receive the focus via the keyboard. For example, pressing left arrow key quickly followed by the tab key while the animation is in progress should put the focus on the right arrow button. Opera only: when pressing the left arrow key quickly followed by the shift key in combination with the right key arrow, the focus should remain on the left arrow button (overcomes some Opera weirdness).
- K4 The jump-to buttons should not be able to receive the focus via the keyboard and are intended for mouse use only.
- K5 Pressing the left arrow key quickly followed by the arrow right arrow key will terminate the current rotation animation and begin a new animation going in the other direction from where the current one left off.
- K6 Causing repeated animations by, for example, holding down an arrow key, or holding down the enter key while an arrow button has focus, should result in repeated rotations of the carousel in the appropriate direction, with each animation completing before the next begins. The animations should not "stack up", meaning that when the key is released the currently running animation should be the last one initiated by that particular key press. (N.B. key repeat behaviour is browser/OS dependant). There should be similar behaviour for when an arrow key is repeatedly tapped.
- K7 Resizing the browser window in order that horizontal scroll bars appear and then pressing the left and right arrow keys when an element within the widget has the focus should not scroll the page.
Further Usability Notes
Because the jogger buttons are situated on either side of the carousel's viewport, they are not particularly convenient for backtracking when using the mouse. Given this, a value for the thumbsPerFrame option of more than 3 is not recommended especially when the widget is being used to display thumbnails with larger dimensions.
The jump-to buttons provide both a means of random access and a visual cue to the user of where they are in the data set. By design they may not be given the focus via the keyboard.
Browser Support
KATC has been successfully tested in the following browers:
- Ubuntu 10.04
- Chrome 13.0
- Firefox 3.6
- Opera 11.5
- Windows XP
- IE 7 (see notes)
- IE 8
- Firefox 1.5
- Firefox 3.6
- Safari 4.0
Notes For IE7 Compatibility
- A patch to make vertical centering work in IE7 is a to-do
- In order that the widget is rendered properly when the browser window is resized, IE7 requires
body {position: relative;} - Use a
DOCTYPEfor standards-compliant mode
Required Files
- jQuery (tested with 1.6.2)
- jquery.katc.js
- katc.css
- Optional: jQuery UI Effects (tested with 1.8.14) required for easing functions (not normally needed)
To Do List
- Patch for vertical centering in IE7
- Applying padding to the jogger buttons is broken
- Jogger button dimensions should default to the dimensions of jogger arrows (essential for Android)
- Fix edge cases e.g. number of thumbnails <
thumbsPerFrame - Simple API: rotate() and refresh()
- Fix yet another problem that occurs in Opera only :-)
- Super-duper blank-spaces-filling mechanism (watch this space)
- Automatically detect completion of thumbnail downloads/retrieval from cache to allow for:
- Automatic sizing of the carousel view port
- Hiding the thumbnails until all downloads complete to avoid ALT text being displayed
- Allow for vertical orientation
- Prepend all CSS class names with 'katc-' to reduce chances of naming collisions
- Allow for an image file to be specified for the arrows on the jogger buttons
- JSLint and jQueryLint fixes
- An HTML jQuery template for use with AJAX
- Apply border to the containing
divonly in the event that JavaScript is enabled
Version History
- 1.0.1 fixed problem caused by a Webkit issue
- 1.0 initial public release
Code Playground To-Dos
- AJAX request to check that lorempixum.com is up
- Example presets
- Unlike KATC itself, it's not fully keyboard accessible! (because of the code editors)