From: Vincent Vanwaelscappel Date: Mon, 12 May 2025 12:37:28 +0000 (+0200) Subject: wip #7461 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=cba96e8ffd564a8c4dc81b878ee73f1c02380b37;p=fluidbook-html5.git wip #7461 @1 --- diff --git a/js/libs/fluidbook/fluidbook.burger.js b/js/libs/fluidbook/fluidbook.burger.js index 1672e542..8f2f9f0e 100644 --- a/js/libs/fluidbook/fluidbook.burger.js +++ b/js/libs/fluidbook/fluidbook.burger.js @@ -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 diff --git a/js/libs/fluidbook/fluidbook.keyboard.js b/js/libs/fluidbook/fluidbook.keyboard.js index 82386f28..5f406372 100644 --- a/js/libs/fluidbook/fluidbook.keyboard.js +++ b/js/libs/fluidbook/fluidbook.keyboard.js @@ -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(); } }); diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index 9dbbaebd..0465cf84 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -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) { diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index dfcc9fc2..58e28ae3 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -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(); - }, }; diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index fc7d0b64..b8c1ca8a 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -63,16 +63,16 @@ FluidbookSearch.prototype = { // with flexbox so they were swapped for
s instead... var html = ''; html += ''; // #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 } diff --git a/style/interface.less b/style/interface.less index 782d263d..74d58813 100644 --- a/style/interface.less +++ b/style/interface.less @@ -190,7 +190,7 @@ transform: translateY(-100%) translateX(-50%); } - .button { + button { display: flex; align-items: center; justify-content: center; @@ -199,6 +199,8 @@ color: inherit; font-size: 1em; cursor: pointer; + border:0; + background-color: transparent; } .searchResultsNavField {