-
Notifications
You must be signed in to change notification settings - Fork 106
fix: focus search inputs only on non-touch devices #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
| :placeholder="$t('search.placeholder')" | ||
| v-bind="noCorrect" | ||
| :autofocus="!isMobile" | ||
| :autofocus="autofocus" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the autofocus if we are manually focusing on mount?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for client side navigation - without it it doesn't focus when navigating from index to search page
but I'm very up for other ideas!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dodgy mechanism I looked at implementing was watching the route. Then if the new route.name was search but old one was not, it would focus the searchbox. Might be able to do the same thing here just include the touch part? Although if you are starting search on home screen on mobile you likely want to be auto focused to search to complete it.
I don't know vue/vue router enough to know if on direct nav to search if oldRoute has a value or not.
| return ( | ||
| 'ontouchstart' in window || | ||
| navigator.maxTouchPoints > 0 || | ||
| // @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this rather be @ts-expect-error?
No description provided.