Skip to content

Commit

Permalink
[BUGFIX]: update focus on quick links when keyboard navigation is used (
Browse files Browse the repository at this point in the history
  • Loading branch information
hputzek authored and MattiasNilsson committed Nov 15, 2017
1 parent c9a518e commit 8516367
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions felayout_t3kit/dev/js/main/contentElements/bootstrapSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,24 @@
updateControlAriaLabel($(event.relatedTarget))
})

// Extend keydown function from carousel.js
// Update quick link focus on keyboard use
// This is needed because we navigate with left(37) and right(39) key
$this.on('keydown.bs.carousel', function (event) {
if (event.which === 37 || event.which === 39) {
updateFocusOnQuickLinks()
$.fn.carousel.Constructor.prototype.keydown = function (e) {
if (/input|textarea/i.test(e.target.tagName)) return
switch (e.which) {
case 37:
this.prev()
updateFocusOnQuickLinks()
break
case 39:
this.next()
updateFocusOnQuickLinks()
break
default: return
}
})

e.preventDefault()
}

// Set aria-selected and tab index to true only for active item
function setAriaOnQuickLinks () {
Expand Down

0 comments on commit 8516367

Please sign in to comment.