-
Notifications
You must be signed in to change notification settings - Fork 133
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
Focus not given to first field when redirected to a huh.Form from a tea.Model #421
Comments
I was able to work around this by calling: m.form.NextField()
m.form.PrevField() After initialising my struct. |
Seconding This issue, thanks @keyneston for a workaround 🖤 |
I think I might be running into this issue as well? Though I'm brand new to this library/charm.sh in general so I could also be skill issuing this too. If I set an input as the first field in the form, it doesn't focus take any input. However if I have the first form element be huh.NewSelect it does focus and I can interact with it. I see @keyneston's fix, but I couldn't seem to get it to work for me? Am I just called the Next/PrevField's in the wrong place? Any help would be greatly appreciated.
|
Hey @marcusprice try changing it like: func NewServerLanding(text string) *ServerLanding {
server := "placeholder text"
form := huh.NewForm(
huh.NewGroup(
huh.NewInput().
Value(&server),
),
)
form.NextField()
form.PrevField()
return &ServerLanding{form: form, server: &server}
} This is instead of doing it in the |
Thank you for the response, but it doesn't work for me :( Was able to get an input/forms working in a non-nested model, but doesn't seem to work otherwise. Prob going to see if I can get away without using huh at least for now. I've been stuck trying to figure this out for days now |
Hey @keyneston, in this specific instance, it looks like your problem is in the Please let me know if that fix works on your end too :) |
@cloverLynn @marcusprice if you could provide me with a minimum reproducible version of your code, I would be happy to take a look :) |
Describe the bug
When directed to a
huh
model from another bubbletea model, the initial input does not have focus. This is exacerbated by, but does not require, the use of a field validation. If a field validation is used it soft-locks the program. If a field validation is not used on the first field then one can simplytab
andshift-tab
back.To Reproduce
huh
model. (Alternatively run the reproduction code below)Input
tab
/shift-tab
off theInput
.Expected behavior
When the
huh
model is rendered the initial input field should have focus and you should be able to type into it.Screenshots
What isn't visible is I'm trying to type into the
Input
field.Desktop:
go.mod
The text was updated successfully, but these errors were encountered: