Skip to content

Prompt to remove tag when value is cleared and Done is pressed#105

Closed
dougborg wants to merge 3 commits intoFoggedLens:mainfrom
dougborg:fix/tag-value-clear-on-done
Closed

Prompt to remove tag when value is cleared and Done is pressed#105
dougborg wants to merge 3 commits intoFoggedLens:mainfrom
dougborg:fix/tag-value-clear-on-done

Conversation

@dougborg
Copy link
Collaborator

Summary

  • Follow-on to Fix tag value reappearing after clearing and pressing Done #104 — now that pressing Done on an empty tag value field no longer auto-selects the first suggestion, this PR wires up an onCleared callback to prompt the user to remove the tag entirely
  • Adds onCleared callback to NSITagValueField — fires when Done is pressed on an empty field
  • All three callers (profile editor, operator profile editor, refine tags sheet) show a "Remove tag?" confirmation dialog
  • 4 widget tests verify the onSubmitted guard and onCleared callback behavior

Changes

  • lib/widgets/nsi_tag_value_field.dart — new onCleared callback, called from onSubmitted when text is empty
  • lib/screens/profile_editor.dart_confirmRemoveTag() dialog, wired to onCleared
  • lib/screens/operator_profile_editor.dart — same pattern
  • lib/widgets/refine_tags_sheet.dart — same pattern for additional existing tags
  • test/widgets/nsi_tag_value_field_test.dart — 4 tests: empty field stays empty, onCleared fires, non-empty doesn't fire onCleared, no-op when onCleared not provided

Test plan

  • 4 widget tests for onSubmitted guard and onCleared callback
  • Manual: clear a tag value, press Done — "Remove tag?" dialog appears
  • Manual: confirm removal — tag row is removed
  • Manual: cancel removal — tag stays with empty value
  • Manual: refinable tags (start empty by design) are unaffected

🤖 Generated with Claude Code

dougborg and others added 2 commits February 11, 2026 09:01
Empty tags are not useful — when a user clears a tag value field and
presses Done, show a confirmation dialog offering to remove the tag
entirely. Applies to profile editor, operator profile editor, and
additional existing tags on the refine sheet. Refinable tags (which
start empty by design) are unaffected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests verify the RawAutocomplete onSubmitted pattern used by
NSITagValueField: Done on empty field calls onCleared (not
onFieldSubmitted), Done on non-empty field auto-completes normally,
and omitting onCleared makes empty submit a safe no-op.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 11, 2026 16:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Address PR review feedback:
- Replace hardcoded English dialog strings with localization keys
- Fix wrong localization namespace (common.* → actions.*)
- Use locService.cancel helper instead of raw key lookup
- Add removeTagTitle/removeTagMessage keys to all 7 locale files
- Trim whitespace before checking emptiness in onSubmitted guard
- Add test for whitespace-only field triggering onCleared

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@stopflock
Copy link
Collaborator

Negative - current UX is fine. If behavior needs to change due to OSM standards, we will make that change silently.
Perhaps we could offer a change preview when submitting, which I think covers the human concerns that this would have addressed.

@stopflock stopflock closed this Feb 12, 2026
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.

3 participants