From 68b9925c9351bb2762ad5ee85d67ee75b0f2567c Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 6 Jan 2021 23:32:22 +0000 Subject: [PATCH] fix(js): no Popper tooltips when search disabled Fix #2084 --- wowchemy/assets/js/wowchemy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wowchemy/assets/js/wowchemy.js b/wowchemy/assets/js/wowchemy.js index 3f90286f..a9a85329 100644 --- a/wowchemy/assets/js/wowchemy.js +++ b/wowchemy/assets/js/wowchemy.js @@ -16,6 +16,8 @@ import { onMediaQueryListEvent, } from './wowchemy-theming'; +const searchEnabled = (typeof search_config !== 'undefined'); + console.debug(`Environment: ${hugoEnvironment}`) /* --------------------------------------------------------------------------- @@ -565,7 +567,7 @@ $(window).on('load', function () { document.activeElement ) || null; let isInputFocused = focusedElement instanceof HTMLInputElement || focusedElement instanceof HTMLTextAreaElement; - if (search_config && !isInputFocused) { + if (searchEnabled && !isInputFocused) { // Open search dialog. event.preventDefault(); toggleSearchDialog(); @@ -575,7 +577,7 @@ $(window).on('load', function () { // Search event handler // Check that built-in search or Algolia enabled. - if (search_config) { + if (searchEnabled) { // On search icon click toggle search dialog. $('.js-search').click(function (e) { e.preventDefault();