iter(g227): 打开后焦点进入时列

This commit is contained in:
HIsheR
2026-10-26 20:07:05 +08:00
parent 11abb36f00
commit 87bdc03213
3 changed files with 6 additions and 2 deletions
+2
View File
@@ -148,6 +148,8 @@ export function timePicker(props: TimePickerProps): HTMLElement {
const { hh, mm } = picked();
reveal(hourCol.col, hourCol.buttons, hh ? Number(hh) : now.getHours()); // 有值先滚到值上
reveal(minuteCol.col, minuteCol.buttons, mm ? minutes.indexOf(nearestMinute(mm)) : Math.floor(now.getMinutes() / step));
const enter = hourCol.buttons.find((el) => el.classList.contains('is-active')) ?? hourCol.buttons[0]; // 打开即把焦点送进时列
enter?.focus({ preventScroll: true }); // preventScroll:别把刚算好的列内滚动位置顶掉
}); // 布局就绪后再量
} else {
releaseEsc?.();