Merge dev into master
This commit is contained in:
@@ -395,9 +395,20 @@ function renderProductFields() {
|
|||||||
|
|
||||||
function filterCatalog() {
|
function filterCatalog() {
|
||||||
const q = document.getElementById('catalogSearch').value.toLowerCase();
|
const q = document.getElementById('catalogSearch').value.toLowerCase();
|
||||||
document.querySelectorAll('#catalogListbox .catalog-list-item').forEach(el => {
|
const words = q.split(/\s+/).filter(Boolean);
|
||||||
el.style.display = (q && !el.textContent.toLowerCase().includes(q)) ? 'none' : '';
|
const listbox = document.getElementById('catalogListbox');
|
||||||
|
if (!listbox) return;
|
||||||
|
listbox.querySelectorAll('.catalog-list-item').forEach(el => {
|
||||||
|
const text = el.textContent.toLowerCase();
|
||||||
|
const hide = words.length > 0 && !words.every(w => text.includes(w));
|
||||||
|
el.style.display = hide ? 'none' : '';
|
||||||
});
|
});
|
||||||
|
// Reset scroll so filtered-in items are always visible at the top.
|
||||||
|
listbox.scrollTop = 0;
|
||||||
|
// Force a layout recalculation — required on iOS Safari so elements that
|
||||||
|
// transition from display:none back to visible register as interactive.
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
listbox.offsetHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pickCatalogItem(el) {
|
function pickCatalogItem(el) {
|
||||||
|
|||||||
Reference in New Issue
Block a user