Fix search not hiding elements

This commit is contained in:
Talia 2025-08-07 18:59:05 +02:00
parent 12850294e9
commit 82ccdb3a55
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -160,7 +160,7 @@ export class BetterSelect extends HTMLElement {
#text:empty ~ *[name="clear"] { #text:empty ~ *[name="clear"] {
display: none; display: none;
} }
[part="drop-down"], [part="item"] { [part="drop-down"], [part~="item"] {
/* Resets */ /* Resets */
border: unset; border: unset;
outline: unset; outline: unset;
@ -195,10 +195,10 @@ export class BetterSelect extends HTMLElement {
cursor: pointer; cursor: pointer;
} }
} }
[part="item"]:focus { [part~="item"]:focus {
font-weight: bold; font-weight: bold;
} }
[part="item"][hidden] { [part~="item"][hidden] {
display: none; display: none;
} }
slot[name="loading"] { slot[name="loading"] {
@ -421,10 +421,11 @@ export class BetterSelect extends HTMLElement {
/** @param {String} value */ /** @param {String} value */
search(value) { search(value) {
for (const item of this.list.children) { for (const item of this.list.children) {
if (item instanceof HTMLElement) if (item instanceof HTMLElement) {
item.toggleAttribute("hidden", !this.match(value, item)) item.toggleAttribute("hidden", !this.match(value, item))
} }
} }
}
selectDefault() { selectDefault() {
const active = this.shadowRoot.activeElement const active = this.shadowRoot.activeElement