`.accessibilityAddTraits(.isHeader)` doesn't merge descendants
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 330
- Forks
- 76
- Avg merge
- 3h 6m
- Merged PRs (30d)
- 1
Description
Text("This is a heading")
.padding(16)
.accessibilityAddTraits(.isHeader)
This doesn't show up as a heading in Android TalkBack, because the heading is applied to the .padding() container, which has no content description, and not to the underlying Text.
You can work around this by rewriting to put the accessibility modifier first, e.g. Text("This is a heading").accessibilityAddTraits(.isHeader).padding(16).
I think it might also work to use composeModifier to add semantics(mergeDescendants: true). (Maybe accessibilityAddTraits should do that as a general rule…?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the accessibilityAddTraits entry point and compare its behavior with the composeModifier workaround described in the issue. Confirm how the modifier is applied around padding and what is exposed to Android TalkBack; done means the example is recognized as a heading without requiring the modifier to precede padding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- accessibility, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100