Accessibility jQuery tabindex enter/return key "clickable" fix

Often UI elements with tabindex="0" will not respond to hitting the enter key. The easiest way to fix this is to create a simple keypress event that simulates a keypress. This hack doesn't require a fix to existing libraries. Below is jQuery Cycle 2 slide show with a pager that normally does not respond to the return key.

Black and white slide of flower in the Columbia Gorge - photo by Greg Black and white slide of two friends looking overlooking Lava Canyon - photo by Greg Black and white slide Red Rocks outside of Las Vegas - photo by Greg

Note that the chevrons do not require any additional JS for the browser to trigger when focused on (tabbed to) and pressing the the enter key. A tags with a href value automatically work with most browsers. However, the spans in this example are purposely not a tags with href values to demostrate the returnKepyress script.