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