diff --git a/src/components/Generator.tsx b/src/components/Generator.tsx index d212a77ff..684563737 100644 --- a/src/components/Generator.tsx +++ b/src/components/Generator.tsx @@ -159,17 +159,11 @@ export default () => { setLoading(false) setController(null) // Determines whether to focus the cursor based on the user agent - if (!isMobileDevice()) + if (!('ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0)) inputRef.focus() } } - const isMobileDevice = () => { - const currentUserAgent = navigator.userAgent - const userAgents = ['Android', 'Windows Phone', 'iPhone', 'iPad', 'iPod'] - return !!userAgents.filter(ua => currentUserAgent.includes(ua)).length - } - const clear = () => { inputRef.value = '' inputRef.style.height = 'auto'