From cdc4f1a8407449be7a514414795f27ff3b70bf37 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Tue, 22 Feb 2022 13:36:08 -0500 Subject: [PATCH] fix: relink search button (move outside content load listener) --- layouts/partials/search.html | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/layouts/partials/search.html b/layouts/partials/search.html index c2ff77f0c..6cc7e24f8 100644 --- a/layouts/partials/search.html +++ b/layouts/partials/search.html @@ -239,20 +239,18 @@ async function run() { } }) - window.addEventListener('DOMContentLoaded', () => { - const searchButton = document.getElementById("search-icon") - searchButton.addEventListener('click', (evt) => { - openSearch() - }) - searchButton.addEventListener('keydown', (evt) => { - openSearch() - }) - searchContainer.addEventListener('click', (evt) => { - closeSearch() - }) - document.getElementById("search-space").addEventListener('click', (evt) => { - evt.stopPropagation() - }) + const searchButton = document.getElementById("search-icon") + searchButton.addEventListener('click', (evt) => { + openSearch() + }) + searchButton.addEventListener('keydown', (evt) => { + openSearch() + }) + searchContainer.addEventListener('click', (evt) => { + closeSearch() + }) + document.getElementById("search-space").addEventListener('click', (evt) => { + evt.stopPropagation() }) }