paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Support adding more accessibility information

Open VirtualParticle opened this issue 8 months ago • 0 comments

This is currently how the text to be shown on the accessibility pane is chosen:

private fun SemanticsNode.accessibilityText() =
  (
    config.getOrNull(SemanticsProperties.ContentDescription)?.joinToString(", ")
      ?: config.getOrNull(SemanticsProperties.Text)?.joinToString(", ")
      ?: config.getOrNull(SemanticsProperties.StateDescription)
      ?: config.getOrNull(SemanticsActions.OnClick)?.label
      ?: config.getOrNull(SemanticsProperties.Role)?.toString()
    ).let {
    // Escape newline characters to simplify accessibility text.
    it?.replaceLineBreaks()
  }

I think adding some extra info like Heading or Selected would be helpful, maybe even more if it fits the circumstance. Not sure if it would be best to just add it here or make AccessibilityRenderExtension take in some properties for that. The way that it currently only picks one also means that we can't see both the text and the role if they're both present, for example.

VirtualParticle avatar Jun 19 '24 18:06 VirtualParticle