From e77bd5f052d917574dbca131b0b8a8f64a889047 Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Fri, 7 Feb 2025 23:50:08 +0000 Subject: [PATCH 1/9] Allow a no-results option with role=none --- examples/index.html | 16 ++++++++++++---- src/autocomplete.ts | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/index.html b/examples/index.html index 2b90b7d..b7b09c7 100644 --- a/examples/index.html +++ b/examples/index.html @@ -100,9 +100,16 @@
- + @@ -119,7 +126,8 @@ - - + + + \ No newline at end of file diff --git a/src/autocomplete.ts b/src/autocomplete.ts index 13126dc..9072274 100644 --- a/src/autocomplete.ts +++ b/src/autocomplete.ts @@ -209,7 +209,9 @@ export default class Autocomplete { this.identifyOptions() this.combobox.indicateDefaultOption() const allNewOptions = this.results.querySelectorAll('[role="option"]') - const hasResults = !!allNewOptions.length + + const hasResults = + !!allNewOptions.length || !!this.results.querySelectorAll('[data-no-result-found="true"]').length const numOptions = allNewOptions.length const [firstOption] = allNewOptions From 96a6015bd5a93b9a50078b93c675437de4559a20 Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Fri, 7 Feb 2025 23:52:04 +0000 Subject: [PATCH 2/9] uncomment script --- examples/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/index.html b/examples/index.html index b7b09c7..8ac4e16 100644 --- a/examples/index.html +++ b/examples/index.html @@ -126,8 +126,8 @@ - - + + \ No newline at end of file From e3395c9f18a2e7ff6b7dd36256b8b4dfbfb4d3fb Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Fri, 7 Feb 2025 23:52:23 +0000 Subject: [PATCH 3/9] uncomment script --- examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index 8ac4e16..78099a5 100644 --- a/examples/index.html +++ b/examples/index.html @@ -126,7 +126,7 @@ - + From 893113f4e47738135e267efc111040d9c3192724 Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Fri, 7 Feb 2025 15:52:48 -0800 Subject: [PATCH 4/9] Update examples/index.html --- examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index 78099a5..af2d1ef 100644 --- a/examples/index.html +++ b/examples/index.html @@ -126,7 +126,7 @@ - + From 55240a9ee4574f76d4f674c5f99076ec0fb665b7 Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Fri, 7 Feb 2025 15:53:25 -0800 Subject: [PATCH 5/9] Update examples/index.html --- examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index af2d1ef..b3dcb9f 100644 --- a/examples/index.html +++ b/examples/index.html @@ -126,7 +126,7 @@ - + From 4cb7c754a42ed8f148026f988e638a9b22bc91bf Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Tue, 11 Feb 2025 12:40:37 -0800 Subject: [PATCH 6/9] Update examples/index.html --- examples/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index b3dcb9f..3d312a2 100644 --- a/examples/index.html +++ b/examples/index.html @@ -104,7 +104,6 @@