Skip to content

Commit 4d9604f

Browse files
committed
fix: hourElement focus issue
1 parent c2f48e4 commit 4d9604f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-flatpickr-plus",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Flatpickr is a lightweight and powerful datetime picker. Svelte Flatpickr Plus is a wrapper for Flatpickr with some extra features.",
55
"homepage": "https://github.com/kodaicoder/svelte-flatpickr-plus",
66
"bugs": {

src/lib/actions.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,16 @@ function attachFlatpickr(node, opts, plugins = opts.noCalendar ? [] : [new yearD
212212
}
213213
} else {
214214
instance.input.setAttribute('readonly', true);
215+
const dayElement = await instance.days;
216+
if (dayElement) {
217+
if (dayElement.querySelector('.today')) {
218+
dayElement.querySelector('.today').focus();
219+
} else {
220+
dayElement.querySelector('.selected').focus();
221+
}
222+
return
223+
}
215224
instance.hourElement.focus()
216-
console.log();
217225
}
218226
},
219227
...opts.onOpen

0 commit comments

Comments
 (0)