]> _ Git - fluidbook-html5.git/commitdiff
wait #7547 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 4 Jul 2025 11:07:54 +0000 (13:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 4 Jul 2025 11:07:54 +0000 (13:07 +0200)
js/libs/fluidbook/fluidbook.keyboard.js

index 2fb027686fa05c5ba6c99b302a13145b9e20511b..dd0aae0eb85b5f1867bbb5054be47503d2b275ae 100644 (file)
@@ -26,12 +26,9 @@ FluidbookKeyboard.prototype = {
                 $this.tabNavigation('.mview', dir);
                 e.preventDefault();
             } else {
-                if ($this.tabNavigationSections([
-                    '#next', '#previous',
-                    '.audio-description-wrapper.left', '.audio-description-wrapper.right', //.
+                if ($this.tabNavigationSections(['#next', '#previous', '.audio-description-wrapper.left', '.audio-description-wrapper.right', //.
                     '#links .leftContainer .linksHolder', '#links .rightContainer .linksHolder', //.
-                    '#links .leftContainer .bookmark', '#links .rightContainer .bookmark',
-                    '#last', '#first', //.
+                    '#links .leftContainer .bookmark', '#links .rightContainer .bookmark', '#last', '#first', //.
                     '#horizontalNav', '#menuOpener', //.
                     '#logo', //.
                     '#credits',], dir)) {
@@ -141,12 +138,15 @@ FluidbookKeyboard.prototype = {
             elements = $(selector).find(focusableElementsString);
         }
         var list = [];
+        console.log(selector,elements);
         $(elements).each(function () {
             if (parseInt($(this).attr('tabindex')) < 0) {
                 return;
             }
             if ($(this).parents('[tabindex="-1"],.ignore-tab-children').length === 0 && $(this).is(':visible')) {
                 list.push(this);
+            } else {
+                console.log('skip', this);
             }
         });
         if (list.length === 0) {
@@ -175,6 +175,10 @@ FluidbookKeyboard.prototype = {
         }
         var items = $(list);
         var nb = items.length;
+        if (!nb) {
+            console.log('no item here', list);
+            return false;
+        }
         var next;
         if ($(items).has(document.activeElement)) {
             var index = $(items).index(document.activeElement);
@@ -196,6 +200,7 @@ FluidbookKeyboard.prototype = {
                 next = nb - 1;
             }
         }
+
         var ne = $(items).eq(next);
         console.log(items, ne);
         $.each(actions, function (k, action) {
@@ -209,21 +214,6 @@ FluidbookKeyboard.prototype = {
         return true;
     },
 
-    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], button';
-        var elements = $(selector).find(focusableElementsString);
-        var list = [];
-        $(elements).each(function () {
-            if ($(this).attr('tabindex') == '-1') {
-                return;
-            }
-            if ($(this).parents('.ignore-tab-children').length === 0 && $(this).is(':visible')) {
-                list.push(this);
-            }
-        });
-        return this._navigate(list, dir);
-    },
-
     initBookmarksShortcuts: function () {
         var $this = this;
         this.keyShortcut('ctrl+alt+d', function () {