LP1882591 Empty combobox avoids default selection
authorBill Erickson <berickxx@gmail.com>
Mon, 8 Jun 2020 20:03:14 +0000 (16:03 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 28 Jul 2020 13:46:10 +0000 (09:46 -0400)
When clearing a combobox value, no combobox options are displayed in the
dropdown.  This allows users to clear the value then tab out of the box
without the typeahead magic forcing selection of the first entry.

The full list can still be displayed by clicking on the combobox.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index 3f5aab8..2afbe41 100644 (file)
@@ -377,12 +377,13 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit {
             mergeMap(term => this.addAsyncEntries(term)),
             map((term: string) => {
 
-                if (term === '' || term === '_CLICK_') {
-                    if (!this.asyncDataSource) {
-                        // In sync mode, a post-focus empty search or
-                        // click event displays the whole list.
-                        return this.entrylist;
-                    }
+                // Display no values when the input is empty and no
+                // click action occurred.
+                if (term === '') { return []; }
+
+                // In sync-data mode, a click displays the full list.
+                if (term === '_CLICK_' && !this.asyncDataSource) {
+                    return this.entrylist;
                 }
 
                 // Filter entrylist whose labels substring-match the