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