Skip to content
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

select search text on search focus #203

Merged
merged 3 commits into from Jan 27, 2022

Conversation

WeekendWarrior1
Copy link
Contributor

Super simple change, simply selects any existing text within the search box when focused.

Functionality at the moment is to just give focus, but the previous search is left in the search box and requires backspacing to execute a fresh search.

@jeffvli
Copy link
Owner

jeffvli commented Jan 26, 2022

Thanks for the PR! I'm planning on reworking the search bar completely soon, but I'd be happy to merge this PR if you resolve the build errors.

Seems like you need to add a type assertion for the element.

@WeekendWarrior1
Copy link
Contributor Author

Thanks for the hint.
Though it worked with just the .select(), I have read here:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select#notes
That it is best practice to focus() and then select(), and have modified the PR accordingly.

PS. Love this software!

@jeffvli
Copy link
Owner

jeffvli commented Jan 27, 2022

Thanks :)

@jeffvli jeffvli added this to the Release (0.12.0) milestone Jan 27, 2022
@jeffvli jeffvli merged commit 2efaa7c into jeffvli:main Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants