charmbracelet / huh

Build terminal forms and prompts 🤷🏻‍♀️
MIT License
4.04k stars 109 forks source link

examples/bubbletea is broken - user unable to navigate to other inputs after accepting/rejecting/toggling/submitting the Confirm field once #315

Open dlipovetsky opened 1 month ago

dlipovetsky commented 1 month ago

Describe the bug The bubbletea example is broken due to https://github.com/charmbracelet/huh/pull/308/commits/49c77ff86bc5327d8271cbb08741f7de0aeb813f, which was added as response to feedback.

The same keys (enter, tab, shift-tab) are bound to multiple actions on the Confirm field. Once the user accepts/rejects/toggles/submits the Confirm field, the user is unable to go to the previous or next field in the group.

https://github.com/charmbracelet/huh/blob/ccca06d54254036ee839c17e21a38560efc523a8/keymap.go#L174-L177

These bindings apparently take precedence:

Making these bindings ineffectual:

To Reproduce Steps to reproduce the behavior:

  1. go run ./examples/bubbletea
  2. Navigate to Confirm field
  3. Select "Wait, no"
  4. Try to navigate to a different field

Expected behavior User should be able to navigate to different fields.

dlipovetsky commented 1 month ago

Can/should huh or bubbletea prevent key binding conflicts within a single field?

meowgorithm commented 1 month ago

Good catch. We’ll fix this posthaste.

@dlipovetsky Good idea: it can and should.