fix: prevent category filter to go to selected cid

if there is an href on the clicked element, like all categories item
This commit is contained in:
Barış Soner Uşaklı
2024-07-03 13:46:52 -04:00
parent ccc8682526
commit 10c5cd4c62

View File

@@ -61,11 +61,12 @@ define('categoryFilter', ['categorySearch', 'api', 'hooks'], function (categoryS
} }
}); });
el.on('click', '[component="category/list"] [data-cid]', function () { el.on('click', '[component="category/list"] [data-cid]', function (ev) {
const listEl = el.find('[component="category/list"]'); const listEl = el.find('[component="category/list"]');
const categoryEl = $(this); const categoryEl = $(this);
const link = categoryEl.find('a').attr('href'); const link = categoryEl.find('a').attr('href');
if (link && link !== '#' && link.length) { if (link && link !== '#' && link.length) {
ev.stopPropagation();
return; return;
} }
const cid = categoryEl.attr('data-cid'); const cid = categoryEl.attr('data-cid');