Replies: 9 comments
-
|
I was able to work around this by calling: m.form.NextField()
m.form.PrevField()After initialising my struct. |
Beta Was this translation helpful? Give feedback.
-
|
Seconding This issue, thanks @keyneston for a workaround 🖤 |
Beta Was this translation helpful? Give feedback.
-
|
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. |
Beta Was this translation helpful? Give feedback.
-
|
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 |
Beta Was this translation helpful? Give feedback.
-
|
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 |
Beta Was this translation helpful? Give feedback.
-
|
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 :) |
Beta Was this translation helpful? Give feedback.
-
|
@cloverLynn @marcusprice if you could provide me with a minimum reproducible version of your code, I would be happy to take a look :) |
Beta Was this translation helpful? Give feedback.
-
|
@keyneston This is not due to a bug in huh but rather a problem with
See this discussion in the bubbletea repo for some extra information about nested components. Particularly that you need to initialize submodules from the parent. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @keyneston I'm not sure if you're still having this problem. There are a couple of suggestions here that you can try. I'm going to convert this to a discussion as it seems it might be related to your implementation rather than a bug in Huh. If this ends up being something we need to address in Huh's source code, we'll convert this back to an issue! Please let us know if you're still having an issue and if not, what solved it for you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
When directed to a
huhmodel 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 simplytabandshift-tabback.To Reproduce
huhmodel. (Alternatively run the reproduction code below)Inputtab/shift-taboff theInput.Expected behavior
When the
huhmodel 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
Inputfield.Desktop:
go.mod
Beta Was this translation helpful? Give feedback.
All reactions