svelte-typeahead 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-typeahead",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "license": "MIT",
5
5
  "description": "Accessible, fuzzy search typeahead component",
6
6
  "author": "Eric Liu (https://github.com/metonym)",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "fuzzy": "0.1.3",
28
- "svelte-search": "^2.1.1"
28
+ "svelte-search": "^2.1.2"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -212,7 +212,15 @@
212
212
  }}
213
213
  on:clear
214
214
  on:clear={open}
215
- on:blur
215
+ on:blur={(e) => {
216
+ // Check if focus is moving to an element within the combobox
217
+ const relatedTarget = e.relatedTarget;
218
+ if (relatedTarget && comboboxRef?.contains(relatedTarget)) {
219
+ return;
220
+ }
221
+ // Close immediately for keyboard navigation (Tab, Shift+Tab)
222
+ close();
223
+ }}
216
224
  on:keydown
217
225
  on:keydown={(e) => {
218
226
  if (results.length === 0) return;
@@ -253,8 +261,9 @@
253
261
  class:selected={selectedIndex === index}
254
262
  class:disabled={result.disabled}
255
263
  aria-selected={selectedIndex === index}
256
- on:click={() => {
264
+ on:mousedown={(e) => {
257
265
  if (result.disabled) return;
266
+ e.preventDefault(); // Prevent input from losing focus
258
267
  selectedIndex = index;
259
268
  select();
260
269
  }}