hideArrows: function (id) {
$(id).addClass('hidden').attr('aria-hidden', 'true');
- $(id).find('a').attr('tabindex', '-1');
+ $(id).find('a').prop('tabindex', -1);
},
showArrows: function (id) {
$(id).removeClass('hidden').attr('aria-hidden', 'false');
- $(id).find('a').attr('tabindex', null);
+ $(id).find('a').prop('tabindex', 0);
},
updateShadows: function (page, animationDuration) {
screenfull.exit();
}
});
+ this.keyShortcut('tab,shift+tab', function (e, handler) {
+ if ($this.fluidbook.menu.viewMode()) {
+ $this.tabNavigation('.mview', handler.shortcut === 'tab' ? 1 : -1);
+ e.preventDefault();
+ }
+ }, false, false);
+
+
if (this.fluidbook.settings.fullscreen) {
this.keyShortcut('f11', function () {
screenfull.toggle();
}
},
+ _navigate: function (list, dir) {
+ if (dir === undefined) {
+ dir = 1;
+ }
+ var items = $(list);
+ console.log(list);
+ var nb = items.length;
+ var next;
+ if ($(items).has(document.activeElement)) {
+ var index = $(items).index(document.activeElement);
+ next = (nb + index + dir) % nb;
+ console.log('n', nb);
+ } else {
+ if (dir === 1) {
+ next = 0;
+ } else {
+ next = nb - 1;
+ }
+ }
+ console.log(next);
+ var ne = $(items).eq(next);
+ $(ne).focus();
+ },
+
+ tabNavigation: function (selector, dir) {
+ var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"]:not(.ps__thumb-x):not(.ps__thumb-y), [contenteditable]';
+ this._navigate($(selector).find(focusableElementsString), dir);
+ },
+
initBookmarksShortcuts: function () {
var $this = this;
this.keyShortcut('ctrl+alt+d', function () {
if ($this.fluidbook.search.isHintsNavOpened()) {
$this.fluidbook.search.navigateHint(handler.key === 'down' ? 1 : -1);
e.preventDefault();
- }else if($this.fluidbook.search.isResultsOverviewOpened()) {
+ } else if ($this.fluidbook.search.isResultsOverviewOpened()) {
$this.fluidbook.search.navigateResults(handler.key === 'down' ? 1 : -1);
}
}, false, false);
$("#view").append(res);
},
- getCaption:function(caption, close, cls) {
+ getCaption: function (caption, close, cls) {
if (cls === undefined) {
cls = '';
}
},
navigateHint: function (dir) {
- this._navigate("#menuSearchHints .hint", '.hint', dir);
+ this.fluidbook.keyboard._navigate("#menuSearchHints .hint", dir);
},
navigateResults: function (dir) {
- this._navigate('#menuSearchResults .doubleThumb', '.doubleThumb', dir);
+ this.fluidbook.keyboard._navigate('#menuSearchResults .doubleThumb', dir);
},
- _navigate: function (listSelector, elementSelector, dir) {
- if (dir === undefined) {
- dir = 1;
- }
- var hints = $(listSelector);
- var nbhints = hints.length;
- var next;
- if ($(document.activeElement).is(elementSelector)) {
- var index = $(hints).index(document.activeElement);
- next = (nbhints + index + dir) % nbhints;
- } else {
- if (dir === 1) {
- next = 0;
- } else {
- next = nbhints - 1;
- }
- }
- var ne = $(hints).eq(next);
- $(ne).focus();
- },
-
-
closeResultsNav: function (keepSearch) {
keepSearch = keepSearch !== 'undefined' ? keepSearch : false;