Fix tag value reappearing after clearing and pressing Done#104
Merged
stopflock merged 3 commits intoFoggedLens:mainfrom Feb 11, 2026
Merged
Fix tag value reappearing after clearing and pressing Done#104stopflock merged 3 commits intoFoggedLens:mainfrom
stopflock merged 3 commits intoFoggedLens:mainfrom
Conversation
RawAutocomplete.onFieldSubmitted auto-selects the first option when called, which means pressing "Done" on an empty tag value field re-populates it with the first NSI suggestion. These tests prove the bug exists (unguarded path) and verify the fix (guarded path). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…appearing When a user clears a tag value and presses Done, RawAutocomplete's onFieldSubmitted auto-selects the first option from the suggestions list. Since optionsBuilder returns all suggestions for empty text, this causes the cleared value to reappear. Guarding the call on non-empty text prevents the auto-selection while preserving autocomplete behavior when the user has typed a partial match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a mobile keyboard “Done” submission edge case in the NSI tag value autocomplete field where clearing the input and submitting would inadvertently re-select the first suggestion.
Changes:
- Guard
RawAutocomplete’sonFieldSubmittedcall so it only runs when the text is non-empty. - Add widget tests that reproduce the buggy behavior and verify the guarded behavior.
- Add a widget test ensuring autocomplete still completes when partial text is present.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/widgets/nsi_tag_value_field.dart | Prevents empty-submit from auto-selecting the first NSI suggestion by guarding onSubmitted. |
| test/widgets/nsi_tag_value_field_test.dart | Adds regression tests for the empty-submit bug, the fix, and a partial-text autocomplete scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The RawAutocomplete tests proved the pattern and fix but never instantiated NSITagValueField itself — no actual coverage gained. PR FoggedLens#36 replaces the widget entirely, so investing in testability here isn't worthwhile. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
stopflock
approved these changes
Feb 11, 2026
Collaborator
stopflock
left a comment
There was a problem hiding this comment.
Thank goodness. Approve approve approve lol
5 tasks
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
RawAutocomplete.onFieldSubmittedauto-selects the first option when called — designed for desktop Enter key, not mobile Done. SinceoptionsBuilderreturns all suggestions when text is empty, pressing Done on an empty field triggers auto-selection of the first suggestion.onFieldSubmittedon non-empty text. When Done is pressed on an empty field, fire anonClearedcallback instead — callers use this to prompt for tag removal since empty tags are not useful.Test plan
🤖 Generated with Claude Code