maestro icon indicating copy to clipboard operation
maestro copied to clipboard

Nested Text accessibility (without Touchables) on React Native

Open matt-dalton opened this issue 1 year ago • 1 comments

I've seen the guidance on nested text here.

The example there suggests wrapping each Text with TouchableOpacity. Also the texts themselves aren't actually nested, but the TouchableOpacitys are.

It's quite common in React Native to nest the texts themselves (usually to inherit the styling from the outer Text). A common use-case here is to add onPress to the text itself, rather than wrapping in a button. Like this: Screenshot 2023-02-21 at 13 04 04

If I try this, only the overall text is shown as something accessible Screenshot 2023-02-21 at 12 33 09

Should this work? Is this a react native issue, or a maestro issue?

My problems with the example in the docs are that:

  • The text isn't actually nested (no style inheritance)
  • If you wrap the inner text with a TouchableOpacity, it breaks styling because of spacing React Native adds Screenshot 2023-02-21 at 13 07 02

matt-dalton avatar Feb 21 '23 13:02 matt-dalton