Adding empty, field and item, working on input group

This commit is contained in:
Ronan Berder
2025-11-02 11:56:40 +08:00
parent 15473865b4
commit ab44d6d48a
29 changed files with 2154 additions and 299 deletions
+5 -4
View File
@@ -16,7 +16,8 @@
return;
}
const options = Array.from(listbox.querySelectorAll('[role="option"]'));
const allOptions = Array.from(listbox.querySelectorAll('[role="option"]'));
const options = allOptions.filter(opt => opt.getAttribute('aria-disabled') !== 'true');
let visibleOptions = [...options];
let activeIndex = -1;
@@ -69,7 +70,7 @@
const resetFilter = () => {
filter.value = '';
visibleOptions = [...options];
options.forEach(opt => opt.setAttribute('aria-hidden', 'false'));
allOptions.forEach(opt => opt.setAttribute('aria-hidden', 'false'));
};
if (hasTransition()) {
@@ -110,11 +111,11 @@
setActiveOption(-1);
visibleOptions = [];
options.forEach(option => {
allOptions.forEach(option => {
const optionText = (option.dataset.label || option.textContent).trim().toLowerCase();
const matches = optionText.includes(searchTerm);
option.setAttribute('aria-hidden', String(!matches));
if (matches) {
if (matches && options.includes(option)) {
visibleOptions.push(option);
}
});