fix(kyc): clear stale country-field error on selection and neutralize the misleading hint#825
Merged
Merged
Conversation
Contributor
Author
Verification summaryRoot cause (all pre-existing since #141 — not a regression of recent staging work):
Fix
Applies to all 5 CountryField usages (nationality, personal/address/tax registration steps, settings->edit address). Verification (m5me, Flutter 3.41.6, byte-identical to CI):
Note (out of scope, pre-existing): dropdown items render English country names even in the DE app — a follow-up for the country-name i18n topic above. |
TaprootFreak
added a commit
that referenced
this pull request
Jul 12, 2026
… hint (#825) (#832) ## Problem `staging` Visual Regression is **red**: #825 ("neutralize the misleading hint") changed the country-field `countryHint` from "Schweiz"/"Switzerland" to "Land auswählen"/"Select country" and regenerated the **default** country goldens, but the **state** goldens added by #828 (nationality) and #829 (registration wizard) — which render the empty country field with the old hint — were merged around the same time and were not regenerated for #825's change. On current staging they still show "Schweiz", so they no longer match the rendered UI. ## Fix Regenerated exactly the 11 stale state goldens against current `staging` (with #825's new hint). No test/lib code changed — only the PNG baselines: - `kyc_nationality_page_{submit_loading, submit_failure, validation_error}` - `kyc_registration_page_{address_step, tax_step, forwarding_failed_snackbar, submit_failure_snackbar}` - `kyc_registration_personal_step_{account_type_open, phone_prefix_open, validation_error}` - `kyc_registration_address_step_validation_error` Each now renders the neutral "Land auswählen" placeholder. The other state goldens in those files (dropdown-open, country-loading, country-error) don't show the hint and are unchanged. ## Verification Regenerated on the CI-identical toolchain (Flutter 3.41.6), two `--update-goldens` runs byte-identical; `git diff` shows exactly these 11 PNGs and nothing else; `flutter analyze` clean; the four affected golden test files pass against the new baselines. This restores `staging` to green.
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.
Problem
The shared KYC country picker (
lib/widgets/form/country_field.dart+lib/widgets/form/dropdown_field.dart, used in 5 places: nationality, registration personal step, address step, tax-residence step, and Settings -> Address) showed three independent, long-standing defects:"Schweiz"/"Switzerland"). Because it is only a hint (initial value isnull), it looked like a pre-selected country when in fact nothing was chosen.country.name, the English API name ("Switzerland","Italy", ...).Form.validate()), an empty selection produced an (invisible) error string and a red border. Even after the user then picked a valid country, the red border stayed, becauseDropdownButtonFormFieldre-validates on change only when anautovalidateModeis set.Root cause (per observation)
countryHintin the ARB files was literally a country name, so a pure placeholder reads as a selection.country.name(English). Note:country.foreignNameis not a German localization — it is the endonym (CH = Schweiz, but IT = Italia, FR = France, US = United States). Swapping inforeignNamewould be wrong for every non-DE country.DropdownButtonFormFieldindropdown_field.darthad noautovalidateMode(default: disabled). The validator returns an empty error string for an empty selection -> red border; withoutonUserInteractionre-validation,didChangeon a later valid pick never clears it.What this fixes
DropdownFieldnow forwards an optionalautovalidateMode(defaultnull, so every otherDropdownFieldconsumer is unchanged).CountryFieldopts in withAutovalidateMode.onUserInteraction, so selecting a country clears the stale error immediately.countryHintis neutralized to"Land auswählen"/"Select country".Deliberately NOT fixed
foreignNameis the endonym, not a German label, it is not a correct display source. Real country i18n is a separate concern and is out of scope here.Affected surfaces (all 5 usage sites)
nationality, registration personal step, address step, tax-residence step, Settings -> Address.
Tests & goldens
test/widgets/form/country_field_test.dartpinning H3: an untouched field reports an error once the Form is validated, and pickingSwitzerlandafterwards clearshasError(valuesymbol == 'CH') without a secondForm.validate(). Verified the test fails if theautovalidateModeline is removed.flutter analyze: 0 issues.flutter test test/widgets/form/country_field_test.dart: all pass.