Skip to content

Commit

Permalink
[FEATURE] Bootstrap slider: extend keyboard navigation (#356)
Browse files Browse the repository at this point in the history
* Change html structure of slider:
** slider arrows
** slider navigation
** slider content

Add handler to allow changing the current slide by keyboard (pressing enter)
Make whole dot-nativation selectable
  • Loading branch information
hputzek authored and MattiasNilsson committed Nov 24, 2017
1 parent c4f408a commit 7a3cf26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions felayout_t3kit/dev/js/main/contentElements/bootstrapSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
var $control = $this.find('.carousel-control')
var $btn = $this.find('.carousel__btn')

// Set tabindex on quicklinks on init
$quickLinks.attr('tabindex', 0)

// add handler to quickLinks to allow changing the slide via enter key
$this.on('keydown', $quickLinks, function (e) {
if (e.which === 13) {
$(e.target).trigger('click')
}
})

// Enable swipe for each carousel element
$this.swipe({
swipe: function (event, direction) {
Expand Down Expand Up @@ -58,9 +68,9 @@
$quickLinks.each(function () {
var link = $(this)
if (link.hasClass('active')) {
link.attr({'aria-selected': 'true', 'tabindex': '0'})
link.attr('aria-selected', 'true')
} else {
link.attr({'aria-selected': 'false', 'tabindex': '-1'})
link.attr('aria-selected', 'false')
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
top: 0;
left: 0;
bottom: 0;
z-index: 2;
width: @carousel-control-width;
font-size: @carousel-control-font-size;
color: @carousel-control-color;
Expand Down

0 comments on commit 7a3cf26

Please sign in to comment.