iter(g227): 打开后焦点进入时列
This commit is contained in:
@@ -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?.();
|
||||
|
||||
Reference in New Issue
Block a user