]> _ Git - fluidbook-html5.git/commitdiff
wip #7461 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 May 2025 12:37:28 +0000 (14:37 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 May 2025 12:37:28 +0000 (14:37 +0200)
js/libs/fluidbook/fluidbook.burger.js
js/libs/fluidbook/fluidbook.keyboard.js
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.nav.js
js/libs/fluidbook/fluidbook.search.js
style/interface.less

index 1672e542d49738025391d1564d33340570734534..8f2f9f0e72743d01c6a9fd115b44a10e08c74d2f 100644 (file)
@@ -203,8 +203,6 @@ FluidbookBurger.prototype = {
             $("#view").attr('aria-hidden', 'true');
             $("#menu").attr('aria-hidden', 'false');
             $("#menuOpener").attr('aria-expanded', 'true');
-        } else {
-            console.log('already opened');
         }
         this.isOpened = true;
     },
@@ -248,7 +246,6 @@ FluidbookBurger.prototype = {
         if (!this.fluidbook.search.isSearchActive()) {
             if (!this.fluidbook.settings.searchFullBurger) {
                 this.fluidbook.search.initSearchHints(); // Clears menu and only displays search box
-                this.closeAll(); // Make sure we're on the main panel with the search box
             }
         }
 
@@ -330,7 +327,13 @@ FluidbookBurger.prototype = {
 
         //$("#q").keyup(searchHints);
         $(document).on('keyup', '#q', function (key) {
+            console.log(key);
+            if(key.ctrlKey){
+                return;
+            }
             switch (key.which) {
+                case 17: // Ctrl key
+                case 18: // Alt key
                 case 13: // Enter key
                 case 37: // Left arrow
                 case 38: // Up arrow
index 82386f28bd99465b5382b1df04adf3c98e97527b..5f406372b04bd25eebbc83b7f7b804449afe9454 100644 (file)
@@ -21,6 +21,7 @@ FluidbookKeyboard.prototype = {
                 }, true, true);
             }
             $this.fluidbook.search.closeSearch();
+            $this.fluidbook.search.closeResultsNav();
             $this.fluidbook.nav.burger.close();
 
             if ($this.fluidbook.support.isFullscreen()) {
@@ -28,12 +29,15 @@ FluidbookKeyboard.prototype = {
             }
         });
         this.keyShortcut('tab,shift+tab', function (e, handler) {
-            if ($this.fluidbook.nav.burger.isOpened) {
-                $this.tabNavigation('#menu', handler.shortcut === 'tab' ? 1 : -1);
+            let dir = handler.shortcut === 'tab' ? 1 : -1;
+            if ($this.fluidbook.search.isResultNavOpened()) {
+                $this.tabNavigation('#searchResultsNav', dir);
                 e.preventDefault();
-            }
-            if ($this.fluidbook.menu.viewMode()) {
-                $this.tabNavigation('.mview', handler.shortcut === 'tab' ? 1 : -1);
+            } else if ($this.fluidbook.nav.burger.isOpened) {
+                $this.tabNavigation('#menu', dir);
+                e.preventDefault();
+            } else if ($this.fluidbook.menu.viewMode()) {
+                $this.tabNavigation('.mview', dir);
                 e.preventDefault();
             }
         }, false, false);
@@ -76,6 +80,7 @@ FluidbookKeyboard.prototype = {
             }
         }
         var ne = $(items).eq(next);
+        console.log(items, ne);
         $.each(actions, function (k, action) {
             if (action === 'focus') {
                 $(ne).focus();
@@ -113,7 +118,7 @@ FluidbookKeyboard.prototype = {
             if ($this.fluidbook.search.isResultNavOpened()) {
                 $this.fluidbook.search.nextResultsPage();
             } else {
-                $this.fluidbook.nav.openSearch();
+                $this.fluidbook.nav.burger.openSearch();
             }
         });
 
index 9dbbaebd15c7bd441c089376b111c5fe5ff622e4..0465cf8403d125fdac9ae80a557d71a03b0d2c4b 100644 (file)
@@ -149,7 +149,7 @@ FluidbookMenu.prototype = {
     },
 
     openSearch: function (q, cb) {
-        this.fluidbook.nav.openSearch(q, cb);
+        this.fluidbook.nav.burger.openSearch(q, cb);
     },
 
     openPDF: function (uid, callback) {
index dfcc9fc23298fbacb70ae2d1694d2c692eab623c..58e28ae3b7654ce1731eb9ce648cb9aeeac062d2 100644 (file)
@@ -538,7 +538,7 @@ FluidbookNav.prototype = {
         // Search icon in horizontal menu
         $(document).on(this.fluidbook.input.clickEvent, '#horizontalNav_searchIcon', function (event) {
             event.preventDefault()
-            $this.openSearch();
+            $this.burger.openSearch();
         });
 
         // Share icon
@@ -701,9 +701,5 @@ FluidbookNav.prototype = {
     burgerActive: function () {
         return this.burger.isActive();
     },
-
-    openSearch: function () {
-        return this.burger.openSearch();
-    },
 };
 
index fc7d0b6490fdc0968e713f85b97c4421d34ea77f..b8c1ca8aac6223c8a753b4c4f094700a553749cd 100644 (file)
@@ -63,16 +63,16 @@ FluidbookSearch.prototype = {
         // with flexbox so they were swapped for <div>s instead...
         var html = '';
         html += '<div id="' + this.resultsNavID + '" class="hidden">';
-        html += '<div class="button searchResultsNavField">';
+        html += '<button class="searchResultsNavField">';
         html += getSpriteIcon('nav-search');
         html += '<div class="searchResultsNavQuery"></div>';
-        html += '</div>'; // .searchResultsNavField
+        html += '</button>'; // .searchResultsNavField
         html += '<div class="searchResultsNavArrows">';
-        html += '<div class="button searchResultsPrev" role="button" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></div>';
+        html += '<button class="searchResultsPrev" role="button" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></button>';
         html += '<div class="searchResultsNavCounter"></div>';
-        html += '<div class="button searchResultsNext" role="button" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></div>';
+        html += '<button class="searchResultsNext" role="button" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></button>';
         html += '</div>'; // .searchResultsNavArrows
-        html += '<div class="button searchResultsNavClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
+        html += '<button class="searchResultsNavClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
         html += getSpriteIcon('interface-close');
         html += '</div>'; // .searchResultsNavClose
         html += '</div>'; // #searchResultsNav
@@ -90,7 +90,7 @@ FluidbookSearch.prototype = {
 
         $(document).on(this.fluidbook.input.clickEvent, '.searchResultsNavField', function () {
             $this.closeResultsNav(true);
-            $this.fluidbook.nav.openSearch();
+            $this.fluidbook.nav.burger.openSearch();
         });
 
         $(document).on(this.fluidbook.input.clickEvent, '.searchResultsNext', function () {
@@ -150,10 +150,16 @@ FluidbookSearch.prototype = {
     },
 
     openResultsNav: function (resultPage) {
+        let $this = this;
         this.updateResultsNav(resultPage);
         this.hideableElements.addClass('hidden');
         this.resultsNav.removeClass('hidden');
         $('body').addClass(this.resultsActiveClass);
+        setTimeout(function () {
+            if ($this.fluidbook.input.isUsingKeyboard()) {
+                $("#searchResultsNav .searchResultsNavClose").get(0).focus();
+            }
+        }, 100);
     },
 
     isResultNavOpened: function () {
@@ -759,6 +765,7 @@ FluidbookSearch.prototype = {
         } else {
             try {
                 if ($("#q").val().length == 0) {
+                    console.log(':)');
                     this.hideSearchHints();
                     this.fluidbook.nav.burger.showMenuItems(); // Show main menu items that were hidden previously
                 }
index 782d263d1b601a9ddf0d61cdb89675a7128c6557..74d5881302407180336fb92f966332e7c76ddd05 100644 (file)
     transform: translateY(-100%) translateX(-50%);
   }
 
-  .button {
+  button {
     display: flex;
     align-items: center;
     justify-content: center;
     color: inherit;
     font-size: 1em;
     cursor: pointer;
+    border:0;
+    background-color: transparent;
   }
 
   .searchResultsNavField {