vanillaSelectBox icon indicating copy to clipboard operation
vanillaSelectBox copied to clipboard

Issue regarding selection after filter

Open wilsonchyw opened this issue 2 years ago • 0 comments

if you select all the elements when the list is filtered by the textBox it will put the value All to the placeholder even when it does not have all the values selected, if you close and open again the select you will notice that not all the values are checked and the placeholder says All

If I understand correctly, I think it may related to line 1185 of vanillaSelectBox.js. https://github.com/PhilippeMarcMeyer/vanillaSelectBox/blob/540f6bd7677cbc892dd52018cc70e12360271e7e/vanillaSelectBox.js#L1185-L1190

checkAllElement.classList.add("active");
checkAllElement.innerText = self.userOptions.translations.clearAll;
checkAllElement.setAttribute('data-selected', 'true')

this code snippet should wrap inside if (nrChecked === totalAvailableElements). Because the checkAll checkbox should checked if the selected element length equal to the available elements length instead of Checkable length.

Also line 564 https://github.com/PhilippeMarcMeyer/vanillaSelectBox/blob/540f6bd7677cbc892dd52018cc70e12360271e7e/vanillaSelectBox.js#L564-L568 I think selectAll should change to clearAll if the selected element length equal to the available elements length.

I create a pull request should solved this issue #100

wilsonchyw avatar Dec 22 '22 09:12 wilsonchyw