Merge dev into master
This commit is contained in:
@@ -394,10 +394,21 @@ function renderProductFields() {
|
||||
}
|
||||
|
||||
function filterCatalog() {
|
||||
const q = document.getElementById('catalogSearch').value.toLowerCase();
|
||||
document.querySelectorAll('#catalogListbox .catalog-list-item').forEach(el => {
|
||||
el.style.display = (q && !el.textContent.toLowerCase().includes(q)) ? 'none' : '';
|
||||
const q = document.getElementById('catalogSearch').value.toLowerCase();
|
||||
const words = q.split(/\s+/).filter(Boolean);
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user