]> _ Git - fluidbook-html5.git/commitdiff
wip #7547 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Jun 2025 13:06:36 +0000 (15:06 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Jun 2025 13:06:36 +0000 (15:06 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.keyboard.js
js/libs/fluidbook/fluidbook.links.js

index c1a1b624d7e71265ca013e2aa2822c0743b7d4fd..8e6429fc964c5f5c59eeb54409bc1b75056bf304 100644 (file)
@@ -202,6 +202,9 @@ Fluidbook.prototype = {
             return false;
         });
 
+        if (this.settings.logo === '') {
+            $("#logo").hide();
+        }
         if (this.settings.url_link !== '' && this.settings.url_link !== 'http://' && this.settings.url_link !== 'https://') {
             $("#logo").attr('href', '#');
             $(document).on(this.input.clickEvent, '#logo', function () {
index 687ab1eef782a247534a1fe39cc4e6c7968b3985..8d780d76abffb6ce7a86b12789eb3a22a6dbd09c 100644 (file)
@@ -40,13 +40,15 @@ FluidbookKeyboard.prototype = {
                 $this.tabNavigation('.mview', dir);
                 e.preventDefault();
             } else {
-                $this.tabNavigationSections(['#horizontalNav', '#menuOpener', //.
+                if ($this.tabNavigationSections(['#horizontalNav', '#menuOpener', //.
                     '.audio-description-wrapper.left', '.audio-description-wrapper.right', //.
-                    '#links .leftContainer', '#links .rightContainer', //.
+                    '#links .leftContainer .linksHolder', '#links .rightContainer .linksHolder', //.
                     '#next-arrows', '#prev-arrows', //.
+                    '#links .leftContainer .bookmark', '#links .rightContainer .bookmark',
                     '#logo', //.
-                    '#credits',], dir);
-                e.preventDefault();
+                    '#credits',], dir)) {
+                    e.preventDefault();
+                }
             }
         }, false, false);
 
@@ -71,8 +73,9 @@ FluidbookKeyboard.prototype = {
     tabNavigationSections: function (selectors, dir) {
         let currentSection = -1;
         let active = $(document.activeElement);
+
         $.each(selectors, function (k, s) {
-            if ($(s).has(active) || $(s).is(active)) {
+            if (active.is(s) || active.closest(s).length > 0) {
                 currentSection = k;
                 return false;
             }
@@ -81,18 +84,31 @@ FluidbookKeyboard.prototype = {
         if (currentSection === -1) {
             currentSection = 0;
         }
-        if (!this.tabNavigation(selectors[currentSection], dir, false)) {
-            currentSection = (currentSection + selectors.length + dir) % selectors.length;
-            this.tabNavigation(selectors[currentSection], dir, false);
+        let loop = 0;
+        while (!this.tabNavigation(selectors[currentSection], dir, false)) {
+            currentSection += dir;
+            if (currentSection >= selectors.length || currentSection < 0) {
+                return false;
+            }
+            loop++;
+            if (loop++ > selectors.length) {
+                break;
+            }
         }
+        return true;
     },
 
     tabNavigation: function (selector, dir, loop) {
         if (loop === undefined) {
             loop = true;
         }
-        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]';
-        var elements = $(selector).find(focusableElementsString);
+        const 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]';
+        let elements;
+        if ($(selector).is(focusableElementsString)) {
+            elements = $(selector);
+        } else {
+            elements = $(selector).find(focusableElementsString);
+        }
         var list = [];
         $(elements).each(function () {
             if (parseInt($(this).attr('tabindex')) < 0) {
@@ -103,9 +119,14 @@ FluidbookKeyboard.prototype = {
             }
         });
         if (list.length === 0) {
+            console.log(selector, 'nothing here');
             return false;
         }
-        return this._navigate(list, dir, ['focus'], loop);
+        let res = this._navigate(list, dir, ['focus'], loop);
+        if (!res) {
+            console.log(selector, 'end of list');
+        }
+        return res;
     },
 
     _navigate: function (list, dir, actions, loop) {
index f83b1b1aed520b609fd9c28003f8319231138d81..1ee8a1f4a61d4248fcfde25e60410a3160e0d93a 100644 (file)
@@ -753,11 +753,11 @@ FluidbookLinks.prototype = {
 
     setLinksInContainer: function (page, side) {
         var links = $("#links");
-        links.append('<div class="' + side + 'Container container"></div>');
+        links.append('<div class="' + side + 'Container container"><div class="linksHolder"></div></div>');
         var container = links.find('.' + side + 'Container');
         var llinks = this.fluidbook.loader.handleExtension(this.fluidbook.settings.links[page]);
         if (llinks !== '') {
-            container.html(llinks);
+            container.find('.linksHolder').html(llinks);
         } else if (page == 0) {
             container.addClass('empty');
         }