Skip to content

fix(form): skip groups that only contain skippable fields - #794

Open
syf2211 wants to merge 1 commit into
charmbracelet:mainfrom
syf2211:fix/468-skippable-single-field-group
Open

fix(form): skip groups that only contain skippable fields#794
syf2211 wants to merge 1 commit into
charmbracelet:mainfrom
syf2211:fix/468-skippable-single-field-group

Conversation

@syf2211

@syf2211 syf2211 commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Fixes #468 by skipping groups that only contain skippable fields at form start, while preserving intentional blocking welcome screens and navigation behavior.

Motivation

A skippable note as the only field in a group was not skipped when other groups contained interactive fields. The common workaround was adding a blank second note, which affected formatting.

Changes

  • Only force notes to be non-skippable when they are the only field in the entire form (not merely the only field in their group)
  • Treat notes with Next(true) as blocking so burger-style welcome screens still appear
  • Skip groups where every field is skippable during Form.Init(), similar to hidden groups
  • Only auto-advance past skippable fields in Group.Init() when the group has more than one field
  • Improve doAllUpdates test helper to process tea.Sequence messages from Form.Init()

Tests

go test ./...

All tests pass, including new regressions:

  • TestSkipSingleFieldGroup
  • TestSkipSingleFieldOnlyGroup
  • TestSkipNextButtonWelcomeGroup

Notes

  • Consecutive skippable-only groups before an interactive group may still require multiple nextGroup transitions; only the first such group is skipped at init today. Happy to follow up if maintainers want full chaining.
  • Backward navigation into a skippable-only group still shows the note, which seems preferable for welcome content.

Fixes charmbracelet#468

A skippable note as the only field in a group was not skipped at form
start when other groups contained interactive fields. Notes only disabled
skipping when they were the sole field in their group, not when they were
the sole field in the entire form.

- Only force notes to be non-skippable when they are the only field in
  the entire form
- Treat notes with Next(true) as blocking so welcome screens still appear
- Skip groups where every field is skippable during form initialization
- Avoid auto-advancing past a lone skippable field when navigating within
  a group
- Improve test command runner to process tea sequence messages
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.

A note is only skippable if it's in a group containing more than one item, no examples of skip behavior in examples folder

2 participants