beeware / toga

A Python native, OS native GUI toolkit.

Home Page:https://toga.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Voiceover hint for macOS DetailedList items isn't helpful

freakboy3742 opened this issue · comments

Describe the bug

On macOS, the Voiceover assistant describes the content of DetailedList items as "<TogaData: 0xdeadbeef>", or similar. This isn't very helpful for navigation purposes.

Steps to reproduce

  1. Run the DetailedList example
  2. Turn on VoiceOver (Command-F5)
  3. Select an item

The text that is read won't be the title and subtitle, but "<Togadata...>"

Expected behavior

The VoiceOver description should accurately describe the content of the list item

Screenshots

Environment

  • Operating System: macOS
  • Python version: All
  • Software versions:
    • Toga: 0.4.2+

Logs


Additional context

The fix for this is to add an accessibilityValue() objc_method to the implementation of TogaDetailedCell. This is the macOS native implementation of an item in a detailedList; the default implementation is to read the description of the objectValue instance associated with the cell, which is a TogaData object.

We can reliably know that the objectValue will be a TogaData object with title and subtitle keys; these can be used to construct a description that can be read.

See #2233 for a related accessibility feature.