Skip to content

Fix mislabeled trait bit 47 (textArea) and add secureTextField (bit 24)#327

Merged
RoyalPineapple merged 8 commits intomainfrom
RoyalPineapple/fix-trait-bit47
Mar 30, 2026
Merged

Fix mislabeled trait bit 47 (textArea) and add secureTextField (bit 24)#327
RoyalPineapple merged 8 commits intomainfrom
RoyalPineapple/fix-trait-bit47

Conversation

@RoyalPineapple
Copy link
Copy Markdown
Collaborator

@RoyalPineapple RoyalPineapple commented Mar 30, 2026

Summary

Fixes two issues with private UIAccessibilityTraits handling:

Bit 47: scrollabletextArea

The private trait at bit 47 (0x800000000000) was incorrectly named scrollable when it is actually Apple's AXTraitTextArea, set on UITextView and SwiftUI TextEditor. The detection logic was already correct (introduced in #186), but the label was wrong. This renames it to textArea across:

  • Trait constant definition
  • Codable serialization key
  • Localization keys and comments (en/de/ru)
  • Runtime hint logic

Bit 24: new secureTextField trait

Adds handling for AXTraitSecureTextField (bit 24, 0x1000000) so that SecureField and secure UITextField elements are announced as "Secure Text Field." instead of the generic "Text Field.", matching VoiceOver behavior.

Source citation

Adds a comment citing AXRuntime.framework symbols (via facebook/idb AXTraits.h) as the authoritative reference for private trait bit positions.

Test plan

  • xcodebuild build succeeds
  • Existing snapshot tests pass with no regressions
  • UITextView elements still get the correct hint ("Double tap to edit., Use the rotor to access Misspelled Words")
  • UITextField elements still get the correct hint ("Double tap to edit.")
  • SecureField elements get "Secure Text Field." specifier instead of "Text Field."
  • Reference images updated for all device/OS combinations

🤖 Generated with Claude Code

RoyalPineapple and others added 2 commits March 30, 2026 03:29
…crollable

Bit 47 (0x800000000000) of UIAccessibilityTraits is Apple's private
UIAccessibilityTraitTextArea, used by UITextView/TextEditor. It was
incorrectly named "scrollable" when introduced in #186. The logic was
correct (distinguishing UITextView from UITextField) but the naming was
wrong, causing incorrect serialization and misleading code semantics.

Renames the trait, updates Codable encoding, and fixes localization keys.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ate traits

Adds handling for the private secureTextField trait (bit 24,
AXTraitSecureTextField) so SecureField/secure UITextField elements are
announced as "Secure Text Field." matching VoiceOver behavior, instead of
the generic "Text Field." specifier.

Also adds a source citation comment for all private trait bit positions,
referencing AXRuntime.framework symbols as extracted in facebook/idb
PrivateHeaders/AXRuntime/AXTraits.h.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@RoyalPineapple RoyalPineapple changed the title Fix mislabeled private trait: bit 47 is textArea, not scrollable Fix mislabeled trait bit 47 (textArea) and add secureTextField (bit 24) Mar 30, 2026
RoyalPineapple and others added 4 commits March 30, 2026 13:25
Adds a SwiftUISecureField demo view with empty and populated SecureField
alongside a regular TextField for comparison, and a corresponding
snapshot test. Confirms the secureTextField trait (bit 24) produces
the correct "Secure Text Field." specifier distinct from "Text Field."

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds SecureField (empty and populated) to the SwiftUITextEntry demo view
instead of a separate file, so all text entry variants (TextField,
SecureField, TextEditor) are tested together. Updates reference images.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@RoyalPineapple RoyalPineapple marked this pull request as ready for review March 30, 2026 12:13
Consolidates bit position, hex value, name, and UIKit source into a
single reference table above the trait definitions for quick lookup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lity+SnapshotAdditions.swift

Co-authored-by: Soroush Khanlou <soroush@squareup.com>
@RoyalPineapple RoyalPineapple merged commit 9205369 into main Mar 30, 2026
7 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.

2 participants