Thread
#compose
    d

    darkmoon_uk

    1 year ago
    For those implementing Accessibility w/ TalkBack - Are there any common reasons why TalkBack would not say the role of the component? All I get is:'<the button text>, double-tap to activate' whereas with the old View system it would say'<the button text>, button, double-tap to activate' <-- I need this for consistency ...I've tried setting the Role semantic, merging nodes, not merging etc. it just won't say 'Button' and it's driving me up the wall! EDIT: Solved but in an unexpected way - not sure if this is a bug - :google: folk?
    Solved? The only thing that worked for me was to set the Button semantic role on the content inside the button, rather than the button itself. This seems counter intuitive. I would expect that by merging the semantic tree at the button level, you'd collate a Button role from the button, and the ContentDescription from the Text. But this didn't seem to be the case. 👉 It looks like as soon as you have any button content that has semantic properties; the button itself stops contributing any, including it's own button role 🤔 Out of all the combinations I tried, only setting Button role on the Text content would get Talkback to say '<button title>, Button, Double-tap to activate'. Is this a bug? 🐛
    Alex

    Alex

    1 year ago
    I'd file a bug just in case, so the google folk can triage this ⬆️
    Alexandre Elias [G]

    Alexandre Elias [G]

    1 year ago
    that's interesting. there are some quirks in how TalkBack handles Role that Compose has had bugs with in the past
    the way Compose Material
    Button
    adds role is via the
    Role
    parameter on the
    Modifier.clickable
    And we have tested it works correctly in that case
    that said I would also be interested to see a bug with sample code (illustrating the specific ordering/structure of the semantics) as the behavior you describe isn't expected
    also, if you are testing on emulator, note that emulators ship with old versions of TalkBack that can have additional quirks especially with Compose, so it might be worth double-checking that the bug also reproduces on a physical device with fully updated accessibility service
    d

    darkmoon_uk

    1 year ago
    Thanks for the info @Alexandre Elias [G]. I saw the same behaviour on Emulators and my Xiaomi device. Will try to reduce a reproduction project and raise an issue for evaluation.