add focus element utility

This commit is contained in:
end committed 2025-07-01 14:58:05 -07:00
1 parent ed18e08a47
commit c01dd71023
2 files changed
+13

No files matched your search

+4
View File
@@ -6,6 +6,10 @@
"module": "index.ts",
"main": "index.ts",
"exports": {
"./util": {
"types": "./util.ts",
"svelte": "./util.ts"
},
"./complete": {
"types": "./complete.ts",
"svelte": "./complete.ts"
+9
View File
@@ -0,0 +1,9 @@
import type { Action } from 'svelte/action';
/**
* Focuses the given HTML element.
* @param node - The HTML element to focus.
*/
export const focus: Action<HTMLElement> = (node) => {
node.focus();
};