fix(form): skip groups that only contain skippable fields - #794
Open
syf2211 wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Next(true)as blocking so burger-style welcome screens still appearForm.Init(), similar to hidden groupsGroup.Init()when the group has more than one fielddoAllUpdatestest helper to processtea.Sequencemessages fromForm.Init()Tests
go test ./...All tests pass, including new regressions:
TestSkipSingleFieldGroupTestSkipSingleFieldOnlyGroupTestSkipNextButtonWelcomeGroupNotes
nextGrouptransitions; only the first such group is skipped at init today. Happy to follow up if maintainers want full chaining.