Skip to content

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

Open
semihbkgr wants to merge 1 commit intocharmbracelet:mainfrom
semihbkgr:patch-1
Open

Enable prev and next actions when not filtering even if no options are available#450
semihbkgr wants to merge 1 commit intocharmbracelet:mainfrom
semihbkgr:patch-1

Conversation

@semihbkgr
Copy link
Copy Markdown

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
Copy Markdown
Contributor

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
Copy Markdown
Author

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

@semihbkgr
Copy link
Copy Markdown
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