Skip to content

Commit

Permalink
Backport 2.2 - Allow keyboard navigation in browser on product detail…
Browse files Browse the repository at this point in the history
… pages, by fixing fotorama library to not change to a different image when pressing left or right arrow key in combination with certain modifier keys on your keyboard.

(cherry picked from commit d134a23)
  • Loading branch information
hostep committed Oct 4, 2018
1 parent c34ced3 commit 518b0bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/web/fotorama/fotorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -1945,10 +1945,10 @@ fotoramaVersion = '4.6.4';
if (e.keyCode === 27) {
catched = true;
that.cancelFullScreen();
} else if ((e.shiftKey && e.keyCode === 32 && allowKey('space')) || (e.keyCode === 37 && allowKey('left')) || (e.keyCode === 38 && allowKey('up') && $(':focus').attr('data-gallery-role'))) {
} else if ((e.shiftKey && e.keyCode === 32 && allowKey('space')) || (!e.altKey && !e.metaKey && e.keyCode === 37 && allowKey('left')) || (e.keyCode === 38 && allowKey('up') && $(':focus').attr('data-gallery-role'))) {
that.longPress.progress();
index = '<';
} else if ((e.keyCode === 32 && allowKey('space')) || (e.keyCode === 39 && allowKey('right')) || (e.keyCode === 40 && allowKey('down') && $(':focus').attr('data-gallery-role'))) {
} else if ((e.keyCode === 32 && allowKey('space')) || (!e.altKey && !e.metaKey && e.keyCode === 39 && allowKey('right')) || (e.keyCode === 40 && allowKey('down') && $(':focus').attr('data-gallery-role'))) {
that.longPress.progress();
index = '>';
} else if (e.keyCode === 36 && allowKey('home')) {
Expand Down Expand Up @@ -3547,7 +3547,7 @@ fotoramaVersion = '4.6.4';

if ((result.moved || (toggleControlsFLAG && result.pos !== result.newPos && !result.control)) && result.$target[0] !== $fullscreenIcon[0]) {
var index = getIndexByPos(result.newPos, measures.w, opts.margin, repositionIndex);

that.show({
index: index,
time: o_fade ? o_transitionDuration : result.time,
Expand Down
Loading

0 comments on commit 518b0bb

Please sign in to comment.