Skip to content

feat(address-field): name the text field and let callers set its identifier - #78

Merged
romchornyi merged 2 commits into
dashpay:masterfrom
romchornyi-pitcrew:fix/address-field-label
Dec 3, 2026
Merged

romchornyi merged 2 commits into
dashpay:masterfrom
romchornyi-pitcrew:fix/address-field-label

Conversation

@romchornyi-pitcrew

@romchornyi-pitcrew romchornyi-pitcrew commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Closes #59.

The text field of AddressFieldView had no accessibility label and no identifier, and a tap on its label did nothing. VoiceOver had an unnamed field, and UI tests had to tap it by coordinates.

What was done?

  • The text field reads the component's label.
  • A tap anywhere on the label row (outside the accessory) focuses the field. The tap sits behind the row: it adds nothing to the layout or the accessibility tree, and it is not there while the field is disabled, so a host's own tap on a disabled field (an enclosing Button or .onTapGesture) still gets through.
  • New fieldIdentifier(_:) sets the accessibility identifier of the text field alone. It is a method rather than an initializer parameter: the parameter would need an overload of both initializers.
  • A preview and docs/buttons-and-inputs.md.

An identifier the host puts on the whole view, or on a stack around it, keeps working as before: it lands on the label, the field and the buttons, and replaces the field's own. This is measured and documented, not changed.

No visual change: the label row keeps master's layout, with and without an accessory, and all snapshot references match. VoiceOver stops on the label and then on the field with the same name; the label stays an element because UI flows look it up.

How Has This Been Tested?

  • A throwaway app with a UI test, on iOS 26.5 and iOS 18.6 (not in this PR; the package has no app host). On master, iOS 26.5 only, the field has no label and the tap on the label text leaves the keyboard down. With the change the field is labelled, text typed after a tap on the empty part of the label row lands in it, and identifiers behave as described above.
  • The same app, iOS 26.5, master against this head: with an accessory at accessibility3 text size the label and accessory frames match master; a disabled field inside a Button and under an .onTapGesture passes taps on its label row to the host, as on master; an interactive accessory gets its own tap and does not focus the field; performAccessibilityAudit reports no hit-area issue that master does not.
  • AddressFieldViewAccessibilityTests covers only what the method stores. The host-less test bundle has no accessibility tree, so no test in the package covers the field's label, applying the identifier to it, or the tap.
  • The whole suite passes (75 tests, iPhone 17 simulator, iOS 26.5), and all 105 snapshot tests pass against the recorded references.
  • xcodebuild for a generic iOS device, swift build, .github/scripts/conventions.sh and .github/scripts/api-check.sh (no breaking changes).
  • Not tested: VoiceOver itself.

Before / After

  • No visual change (refactor, tests, docs). Say why in "What was done?".

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

🤖 Generated with Claude Code

…tifier

The text field had no accessibility label and no identifier, and a tap on its
label did nothing. It now reads its label, the label row focuses it, and
fieldIdentifier(_:) names the field alone.

Closes dashpay#59

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@romchornyi romchornyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟡 No blockers, no major findings · 2 minor (please fix before merge) · 3 nits — reviewed at a71f0eab66

Level Verdict
1 · Idea ✅ valid The field has no name and no identifier (#59)
2 · Architecture ✅ right layer The component owns the label; a method keeps the API additive
3 · Completeness ✅ complete #49 covers the scan and clear buttons
4 · Code 🟡 2 minor Both in the label row

Minor

  1. A disabled field's label row swallows the host's tap — AddressFieldView.swift#L106. isDisabled is checked inside the closure, so the gesture still wins over an ancestor: for a disabled field in a Button or under an .onTapGesture, a tap on the label row ran the host's action on master and now does nothing (verified on iOS 18.6 and 26.5).
  2. "No visual change" does not hold for an accessory in tight space — AddressFieldView.swift#L104. With the maxWidth: .infinity frame the stack sizes the accessory first, and one 8 pt gap is gone. 38 of 96 configurations differ from master, all with an accessory; for example label "Address" with a "Transparent address" badge, 375 pt, accessibility3: height 95 → 130. Without an accessory the rows are identical (verified by pixel comparison, iOS 26.5). No caller on dashwallet-ios develop passes an accessory, and the recorded snapshots do not show it.

A direction tried for both: keep Text and Spacer(minLength: 0), give the Text .allowsHitTesting(false), and put the tap in a row .background that exists only while enabled and is hidden from accessibility. 96 of 96 layouts matched master (iOS 18.6), label taps focused, and disabled taps reached the host again (both OS versions). Not tried with an interactive accessory.

Before merge: the CI and Breaking changes workflows have not run on this head (action_required); they need approval to run and to pass.

3 nits
  1. The accessibility audit now flags the label — AddressFieldView.swift#L106. performAccessibilityAudit adds "Hit area is too small" (361×18), also when disabled; master does not report it (verified, iOS 26.5). The direction above removes it.
  2. The tests cover only the stored property — with the label, the identifier and the tap all removed, all 75 tests pass (verified). The description states this for the label and the tap, not for applying the identifier.
  3. The docs are too broad about an enclosing stack — buttons-and-inputs.md#L160. On a stack with .accessibilityElement(children: .contain) the field's identifier survives (verified on both OS versions).
Review details

Levels 1–3, a general code lane and a UI lane with a throwaway app and XCUITest, master against this head. Not verified: real VoiceOver, iOS 27, a hardware keyboard, a dashwallet-ios build.

🤖 Reviewed with Claude Code

…s taps

The tap that focuses the field moves from the label to a background behind
the label row, built only while the field is enabled and hidden from
accessibility. The label keeps its Spacer, so the row lays out as before
with an accessory; a disabled field takes no tap of its own, so an enclosing
Button or onTapGesture gets it; and the accessibility audit no longer flags
the label's hit area.

The identifier docs now say that `.accessibilityElement(children: .contain)`
on the view itself, as on a stack around it, keeps the field's own
identifier, and that the accessory keeps its own taps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@romchornyi-pitcrew

Copy link
Copy Markdown
Contributor Author

Follow-up to the review at a71f0eab66, fixed in e662132.

Rule: the label row's tap-to-focus adds nothing to the layout or the accessibility tree, and while the field is disabled the row takes no tap of its own. It is applied at the one site the PR added, the label row in AddressFieldView.

Minor

  1. Disabled field swallows the host's tap. The tap now sits in a .background behind the row, built only while the field is enabled and hidden from accessibility. While the field is disabled the label text stays hittable, so a host gesture on the label reaches the host. Checked with a UI test on iOS 26.5: a disabled field inside a Button and one under .onTapGesture both pass label taps to the host, as on master. At a71f0ea neither did.
  2. Layout changes with an accessory. The label keeps Spacer(minLength: 0) as on master. With the "Transparent address" badge at accessibility3 text size in 335 pt, the label and badge frames match master: label 124×15.7, badge 180.7×156.7. At a71f0ea they were 177.3×18.3 and 149.7×156.7. An interactive accessory gets its own tap and does not focus the field.

Nits

  1. Audit. performAccessibilityAudit (hit region) now reports the same set of issues as master: the text fields and the badge. The label rows it added at a71f0ea are gone.
  2. Tests. The description now says that AddressFieldViewAccessibilityTests covers only the stored property. It does not cover applying the identifier, the label, or the tap, because the host-less bundle has no accessibility tree.
  3. Docs. The doc comment and docs/buttons-and-inputs.md now say that .accessibilityElement(children: .contain) keeps the field's own identifier, on a stack around the view and on the view itself; both were checked. The docs also say that the accessory keeps its own taps.

Checked: the 75 package tests, all 105 snapshot tests, a generic iOS build, swift build, conventions.sh and api-check.sh (no breaking changes). The CI and Breaking changes workflows still need approval to run on this head.

@romchornyi romchornyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ No blockers, no major findings · both minors from the last review closed — reviewed at e6621326af

Level Verdict
1 · Idea ✅ valid Unchanged: the field had no name and no identifier (#59)
2 · Architecture ✅ right layer Unchanged: the component owns the label; a method keeps the API additive
3 · Completeness ✅ complete #49 covers the scan and clear buttons
4 · Code ✅ clean The fix round adds no new findings

Closed since the last review

  • A disabled field's label row swallows the host's tap. The focus tap now sits in a row .background that exists only while the field is enabled and is hidden from accessibility (AddressFieldView.swift#L117-L125). The label text gets .allowsHitTesting(isDisabled) (L107), so while disabled a tap on it reaches the host.
  • Layout changes with an accessory. Spacer(minLength: 0) is back and the Text no longer takes maxWidth: .infinity, so the row keeps master's layout.
  • Nits. The audit no longer flags the label row. The description now states what the tests cover. The doc comment and docs/buttons-and-inputs.md now cover .accessibilityElement(children: .contain) and the accessory's own taps.

Also checked: the label tap sets the @FocusState, and the existing onChange handlers carry it to a host's isFocused binding. accessibilityIdentifier(_:isEnabled:) needs iOS 17, and the package floor is iOS 18.

Before merge: CI and Breaking changes are still action_required on this head. They need approval to run, and then they need to pass.

Review details

This is a re-review of the fix round a71f0eab66..e6621326af: about 30 lines, all in the label row, plus docs. Levels 1–3 were carried over from the previous review because the fix does not touch them. Level 4 was checked by hand against the full file at the head. The general and specialist lanes were not re-run, because the new diff is small.

🤖 Reviewed with Claude Code

@romchornyi
romchornyi merged commit a045afa into dashpay:master Dec 3, 2026
12 checks passed
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.

AddressFieldView: the text field has no accessibility label and no identifier

2 participants