From 32567f6c858329c92742c19a3591c6d1f722d909 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 17 Jan 2024 14:07:42 +0100 Subject: [PATCH 1/3] Minor bug fixes --- static/js/src/navigation.js | 7 +++++-- static/sass/_pattern_navigation.scss | 10 +++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/static/js/src/navigation.js b/static/js/src/navigation.js index bc56296c979..f0b77b15412 100644 --- a/static/js/src/navigation.js +++ b/static/js/src/navigation.js @@ -58,6 +58,9 @@ mainList.addEventListener("click", function (e) { } else { handleDropdownClick(e.target.parentNode); } + } else if (target.tagName == "A") { + // This handles the globa-nav using a slightly different class naming convention + window.location.href = target.href; } }); @@ -105,8 +108,8 @@ function toggleSecondaryMobileNavDropdown(e) { } else { isDropdownOpen = true; } - mobileNavDropdown.classList.toggle("is-open", !isDropdownOpen); - mobileNavDropdownToggle.classList.toggle("is-open", !isDropdownOpen); + mobileNavDropdown?.classList.toggle("is-open", !isDropdownOpen); + mobileNavDropdownToggle?.classList.toggle("is-open", !isDropdownOpen); } function handleDropdownClick(clickedDropdown) { diff --git a/static/sass/_pattern_navigation.scss b/static/sass/_pattern_navigation.scss index 266341348ca..86bf2125ecf 100644 --- a/static/sass/_pattern_navigation.scss +++ b/static/sass/_pattern_navigation.scss @@ -142,7 +142,11 @@ $meganav-height: 3rem; } .p-search-box__input { - background-color: #f2f2f2 !important; + background-color: $color-light !important; + + &:focus, &:hover { + background-color: $color-light !important; + } } .p-search-box__input::placeholder { @@ -188,6 +192,10 @@ $meganav-height: 3rem; &[aria-hidden="false"] { overflow: unset; + + &:before { + pointer-events: none; + } } } From e5aa06c1a56c82dab1f21641960ac82fa79306f8 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 17 Jan 2024 16:43:13 +0100 Subject: [PATCH 2/3] Make global-nav link detection more specific --- static/js/src/navigation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/src/navigation.js b/static/js/src/navigation.js index f0b77b15412..eab281f8798 100644 --- a/static/js/src/navigation.js +++ b/static/js/src/navigation.js @@ -58,7 +58,7 @@ mainList.addEventListener("click", function (e) { } else { handleDropdownClick(e.target.parentNode); } - } else if (target.tagName == "A") { + } else if (target.classList.contains("p-navigation__dropdown") && target.tagName == "A") { // This handles the globa-nav using a slightly different class naming convention window.location.href = target.href; } From 96dc9e740c19285929d5637273248844142151ba Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 18 Jan 2024 10:17:17 +0100 Subject: [PATCH 3/3] Fix linter errors --- static/js/src/navigation.js | 5 ++++- static/sass/_pattern_navigation.scss | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/static/js/src/navigation.js b/static/js/src/navigation.js index eab281f8798..3009493a71d 100644 --- a/static/js/src/navigation.js +++ b/static/js/src/navigation.js @@ -58,7 +58,10 @@ mainList.addEventListener("click", function (e) { } else { handleDropdownClick(e.target.parentNode); } - } else if (target.classList.contains("p-navigation__dropdown") && target.tagName == "A") { + } else if ( + target.classList.contains("p-navigation__dropdown") && + target.tagName == "A" + ) { // This handles the globa-nav using a slightly different class naming convention window.location.href = target.href; } diff --git a/static/sass/_pattern_navigation.scss b/static/sass/_pattern_navigation.scss index 86bf2125ecf..5ce19a6b51c 100644 --- a/static/sass/_pattern_navigation.scss +++ b/static/sass/_pattern_navigation.scss @@ -143,8 +143,9 @@ $meganav-height: 3rem; .p-search-box__input { background-color: $color-light !important; - - &:focus, &:hover { + + &:focus, + &:hover { background-color: $color-light !important; } } @@ -193,7 +194,7 @@ $meganav-height: 3rem; &[aria-hidden="false"] { overflow: unset; - &:before { + &::before { pointer-events: none; } }