routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
export function useAutofocus(props) {
|
||||
function onIntersect(isIntersecting, entries) {
|
||||
if (!props.autofocus || !isIntersecting) return;
|
||||
const el = entries[0].target;
|
||||
const target = el.matches('input,textarea') ? el : el.querySelector('input,textarea');
|
||||
target?.focus();
|
||||
}
|
||||
return {
|
||||
onIntersect
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=autofocus.js.map
|
||||
Reference in New Issue
Block a user