svelte-typeahead 5.0.1 → 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 +1 -1
- package/src/Typeahead.svelte +11 -2
package/package.json
CHANGED
package/src/Typeahead.svelte
CHANGED
|
@@ -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:
|
|
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
|
}}
|