Skip to content

Commit ef57b39

Browse files
committed
fix: Renamed the id's + fixed logic
1 parent c744bcf commit ef57b39

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

assets/js/product-selector.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ document.addEventListener('DOMContentLoaded', () => {
2020
});
2121

2222
window.addEventListener('click', (event) => {
23-
/* Greedy Logic to hide the product selector when something other than the button is clicked. Assumes everything has a classname containing "product-selector" */
24-
if (
25-
event.target.classList.length === 0 ||
26-
!event.target.classList[0].includes('product-selector')
27-
) {
23+
/* Greedy Logic to hide the product selector when something other than the button is clicked. Assumes everything has an id containing "product-selector" */
24+
if (!event.target.id.includes('product-selector')) {
2825
productSelectorContent.style.display = 'none';
2926
productSelectorButton.classList.remove('remove-bottom-radius');
3027
}

layouts/partials/sidebar-v2.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
{{ $type := . }}
4242
{{ $products := index $groupedProducts $type }}
4343
<div class="product-selector-content" id="product-selector-content">
44-
<p class="product-selector-content-product-group-name">{{ $type | humanize | title | upper }}</p>
45-
<ul class="product-selector-content-product-container">
44+
<p id="product-selector-content-product-group-name">{{ $type | humanize | title | upper }}</p>
45+
<ul id="product-selector-content-product-container">
4646
{{ range $products }}
47-
<li class="product-selector-content-product-name">
48-
<a class="product-selector-content-product-link" href="{{ .url }}">{{ .title }}</a>
47+
<li id="product-selector-content-product-name">
48+
<a id="product-selector-content-product-link" href="{{ .url }}">{{ .title }}</a>
4949
</li>
5050
{{ end }}
5151
</ul>

0 commit comments

Comments
 (0)