salix/front/core/lib/focus.js

17 lines
355 B
JavaScript

import isMobile from './is-mobile';
export default function focus(element) {
if (isMobile || !element) return;
setTimeout(() => element.focus(), 10);
}
export function select(element) {
if (isMobile || !element) return;
setTimeout(() => {
element.focus();
if (element.select)
element.select();
}, 10);
}