Skip to content

fix: focus search inputs only on non-touch devices#426

Closed
danielroe wants to merge 1 commit intomainfrom
fix/focus-mounted
Closed

fix: focus search inputs only on non-touch devices#426
danielroe wants to merge 1 commit intomainfrom
fix/focus-mounted

Conversation

@danielroe
Copy link
Copy Markdown
Member

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jan 30, 2026 3:48pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Jan 30, 2026 3:48pm
npmx-lunaria Ignored Ignored Jan 30, 2026 3:48pm

Request Review

Comment thread app/pages/index.vue
:placeholder="$t('search.placeholder')"
v-bind="noCorrect"
:autofocus="!isMobile"
:autofocus="autofocus"
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Member Author

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!

Copy link
Copy Markdown
Contributor

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.

Comment thread app/utils/responsive.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants