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

Enable prev and next actions when not filtering even if no options are available #450

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

semihbkgr
Copy link

fixes #422

It disables prev and next actions when no options are available, including during filtering.

@semihbkgr semihbkgr changed the title Allow prev and next actions even when no options and no filtering Enable prev and next actions when not filtering even if no options are available Nov 3, 2024
@bashbunni
Copy link
Member

hey @semihbkgr is this still a relevant change given this is fixed on main?

If so, please also include an example output of the before and after along with steps to test out this change :)

@bashbunni bashbunni self-assigned this Dec 4, 2024
@semihbkgr
Copy link
Author

Hi @bashbunni, I don't think this issue has been resolved on the main branch, based on my observations.

@semihbkgr
Copy link
Author

It is an example where you cannot move the cursor up or down when there are no items to select in Select.

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"),
	  huh.NewInput().
		  Key("last").
		  Title("Last"),
  ),
)

err := form.Run()
if err != nil {
  panic(err)
}

After the cursor targets the Select, you can neither move to the next item by pressing Tab nor move back by pressing Shift+Tab.

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.

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