Commit c4ab261
committed
fix(iOS): reset accessibility state on view recycle
When a Fabric ComponentView is recycled, _props resets to the
AccessibilityProps default-constructed values. updateProps writes
most accessibility properties only when (oldProps != newProps),
so any UIKit-side state previously set stays stale across recycle
unless cleared in prepareForRecycle. The most visible failure is
`accessibilityViewIsModal` / `accessibilityElementsHidden` trapping
VoiceOver against a now-unrelated subtree.
Reset only the properties whose UIKit default does NOT depend on
the underlying view subclass. `isAccessibilityElement` and
`accessibilityTraits` are intentionally skipped: UIControl /
UILabel / UIImageView each start with different defaults from
UIView, and for RCTText/Image ComponentView `accessibilityElement`
resolves to an inner UILabel / UIImageView whose natural a11y
behavior would be clobbered by a blanket reset. Per-subclass
reset is left as a follow-up.
`accessibilityState` is cleared via the (.NotEnabled | .Selected)
trait bit mask the setter writes on self.accessibilityTraits —
safe across all subclasses.
Addresses review feedback on #57196.1 parent 51c53b7 commit c4ab261
1 file changed
Lines changed: 45 additions & 5 deletions
Lines changed: 45 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
732 | 751 | | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
733 | 773 | | |
734 | 774 | | |
735 | 775 | | |
| |||
0 commit comments