Skip to content

Shift+Tab doesn't go to previous field if Select OptionsFunc returns no options #422

@Hector-Work

Description

@Hector-Work

Describe the bug
If you are focused on a Select field where the OptionsFunc has not returned any options, Shift+Tab doesn't return focus to the previous field.

To Reproduce
Steps to reproduce the behaviour:

search := ""

form := huh.NewForm(
  huh.NewGroup(
    huh.NewInput().
      Key("search").
      Value(&search).
      Title("Search"),
    huh.NewSelect[string]().
      OptionsFunc(func() []huh.Option[string] {
        return []huh.Option[string]{}
      }, &search).
      Title("Select"),
  ),
)

return form

Expected behaviour
The focus should return to the previous field.

Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions