Thomas G. Lopes
UX adjustments (#76)
28faefd unverified
raw
history blame
243 Bytes
import { tick } from "svelte";
export function autofocus(node: HTMLElement, enabled = true) {
function update(enabled = true) {
if (enabled) {
tick().then(() => {
node.focus();
});
}
}
update(enabled);
return { update };
}