Skip to content

Commit 33bdaac

Browse files
committed
fix manualInput month focus
1 parent 3ee50cb commit 33bdaac

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/lib/components/Calendar.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@
9999
}
100100
}
101101
102+
/**
103+
* @param {Date|SvelteDate} date
104+
*/
105+
export function focusDate(date) {
106+
activeDate.setTime(date.getTime());
107+
internalDate = new Date(date.getTime());
108+
}
109+
102110
/** @type Date? */
103111
let internalDate = dates[wid] || null;
104112
/** @type {SvelteDate} */

src/lib/components/SveltyPicker.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@
168168
let isDirty = $derived(autocommit ? false : value_array.join() !== undoHistory.join());
169169
/** refs */
170170
/** @type {Calendar} */
171+
// svelte-ignore non_reactive_update
171172
let ref_calendar;
172-
let ref_input = ce_displayElement;
173173
174174
/**
175175
* Convert value to display value
@@ -395,7 +395,6 @@
395395
case "ArrowUp":
396396
case "ArrowLeft":
397397
case "ArrowRight":
398-
// if (manualInput && ref_input.value) return;
399398
e.preventDefault();
400399
if (isRange) return;
401400
if (currentMode === "date") {
@@ -457,6 +456,7 @@
457456
date: parsedInput,
458457
isKeyboard: true
459458
});
459+
ref_calendar.focusDate(parsedInput);
460460
}
461461
}
462462
@@ -637,7 +637,7 @@
637637
{#if !ce_displayElement}
638638
<input type="hidden" {name} {value}>
639639
{#if !pickerOnly}
640-
<input bind:this={ref_input} type="text"
640+
<input type="text"
641641
id={inputId}
642642
tabindex="0"
643643
name={input_name}

0 commit comments

Comments
 (0)