/** * Focus an element after mount when the condition is truthy. * Uses a microtask to ensure the element is fully rendered. */ export function autofocus(el, condition = true) { if (el && condition) { queueMicrotask(() => el.focus()) } }