bugfix: dropdown search was ignoring whitespace

This commit is contained in:
Jakob Pinterits
2024-07-19 12:59:39 +02:00
parent 1ef832ec7f
commit 8fcd211b81
2 changed files with 10 additions and 6 deletions
+9 -3
View File
@@ -334,7 +334,7 @@ export class DropdownComponent extends ComponentBase {
needleLower: string
): HTMLElement | null {
// Special case: Empty needle matches everything, and would cause a hang
// in the while loop below
// in the `while` loop below
if (needleLower.length === 0) {
const container = document.createElement('div');
container.textContent = haystack;
@@ -433,9 +433,15 @@ export class DropdownComponent extends ComponentBase {
this._highlightOption(element.firstElementChild as HTMLElement);
}
// Resize the element
// Display an icon and resize the element
//
// For some reason the SVG has an explicit opacity set. Because of that,
// using CSS isn't possible. Overwrite the opacity here.
if (element.children.length === 0) {
applyIcon(element, 'material/error');
applyIcon(element, 'material/error').then(() => {
(element.firstElementChild as SVGElement).style.opacity = '0.2';
});
this.popupElement.style.height = '7rem';
} else {
this.popupElement.style.height = `${element.scrollHeight}px`;
+1 -3
View File
@@ -993,7 +993,7 @@ $rio-input-box-small-label-spacing-top: 0.5rem;
display: flex;
flex-direction: column;
align-items: stretch;
white-space: nowrap;
white-space: pre;
cursor: pointer;
}
@@ -1008,8 +1008,6 @@ $rio-input-box-small-label-spacing-top: 0.5rem;
height: 4rem;
margin: 1.5rem auto;
opacity: 0.2;
}
.rio-dropdown-option {