Skip to content

Commit

Permalink
Update InputFocused.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDoge authored Oct 15, 2024
1 parent 7a19ebf commit 2cb6f09
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { tags } from "@purifyjs/core";
import { Lifecycle, tags } from "@purifyjs/core";

const { input } = tags;

export function InputFocused() {
const host = input().type("text");
const host = input()
.use(autoFocus())
.type("text");

host.element.onConnect(() => {
host.element.focus();
});
return host;
}

return host;
export function autoFocus(): Lifecycle.OnConnected {
return (element) => element.focus()
}

0 comments on commit 2cb6f09

Please sign in to comment.