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

Add property to focus textbox on mount #125

Merged
merged 2 commits into from
Mar 2, 2024
Merged

Conversation

samuelselleck
Copy link
Contributor

focus_on_mount={true/false}

@@ -276,6 +276,10 @@ export class NativeElementPool {
if (patch.transform != null) {
leaf.style.transform = packAffineCoeffsIntoMatrix3DString(patch.transform);
}

if (patch.focus_on_mount) {
setTimeout(() => { textbox.focus(); console.log("focused!"); }, 10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason we set a timeout here rather than just call textbox.focus()?
also we can remove the console.log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, Removed log!

Didn't focus correctly for some reason without it, not exactly sure why. It should have been added to the dom already? (requirement for focus to work). I just took the fast path :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool that sounds good. We can figure out later.

@warfaj warfaj merged commit a92e9bd into master Mar 2, 2024
1 check passed
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