salix/front/core/lib/focus.js

17 lines
331 B
JavaScript
Raw Normal View History

2019-11-10 10:08:44 +00:00
import isMobile from './is-mobile';
export default function focus(element) {
if (isMobile) return;
setTimeout(() => element.focus(), 10);
}
export function select(element) {
if (isMobile) return;
setTimeout(() => {
element.focus();
if (element.select)
element.select();
}, 10);
}