element-ios icon indicating copy to clipboard operation
element-ios copied to clipboard

A11y: Context menu for messages is inaccessible to VoiceOver, accessibility actions for message cells are missing.

Open robin24 opened this issue 2 years ago • 5 comments

Steps to reproduce

The context menu that is available for message cells, containing options such as reply, react, etc. is inaccessible to VoiceOver currently. Bringing this up requires a sighted user to perform a long press on the message cell which can't be easily / reliably done with VoiceOver, this can be resolved by exposing the context menu options using UIAccessibilityCustomAction, see https://developer.apple.com/documentation/uikit/uiaccessibilitycustomaction.

Steps to reproduce:

  1. Enable VoiceOver.
  2. Open a room or 1:1 conversation in Element-iOS that contains messages.
  3. Move VoiceOver focus to a message.
  4. Swipe down with one finger.

Outcome

What did you expect?

Using VoiceOver, swiping down while a message is in focus should result in the various context menu options being announced, e.g. reply, react, etc. Performing a double-tap should then perform the selected context menu option.

What happened instead?

Context menu options are currently not accessible using VoiceOver, as UIAccessibilityCustomAction has not been implemented for the various menu items.

Your phone model

iPhone 13 Pro

Operating system version

iOS 15.6

Application version

Element V1.8.22

Homeserver

No response

Will you send logs?

No

robin24 avatar Jul 20 '22 10:07 robin24

FYI, I'd be happy to try fixing this myself, however after having looked at the relevant view controllers I'm honestly unsure where I'd have to define the custom actions in order for them to be exposed on every message cell. It's possible I'm missing something obvious here, so more than happy to give this another shot if someone could point me in the right direction 👍.

robin24 avatar Jul 20 '22 11:07 robin24

Hey @robin24, thanks for looking into this ❤️

A simple starting place would be to use the 4 contextual menu items from here: https://github.com/vector-im/element-ios/blob/58dcf54c55cc1273740103a6cb0b673acd798f13/Riot/Modules/Room/RoomViewController.m#L6526

It wouldn't give you a flat list of actions as most would be nested inside the more item, but I wonder if that might be a nicer user experience anyway, as that will present the more list which should be accessible to VoiceOver.

pixlwave avatar Jul 21 '22 07:07 pixlwave

Ah looking into this a bit deeper I've realised its more complex, as when bubbles are disabled each cell can contain multiple events if they're text messages from the same user. So adding the accessibility actions directly on the cell probably wouldn't work.

They would need to be added to the cell's contents, but there are a lot of those (see Riot/Modules/Room/TimelineCells) 😕

pixlwave avatar Jul 21 '22 09:07 pixlwave

[Hey @pixlwave, Thanks so much for looking into this and your detailed response, it's really greatly appreciated!

Having looked at element-ios/Riot/Modules/Room/RoomViewController.m I did realize that there are way more conditions to determine which context menu options will be presented than I thought, at this point I feel like just adding RoomContextualMenuActionMore to all cells as an AccessibilityCustomAction would probably make the most sense as that would always display a list of options relevant to the currently selected cell, and would be an easy enough way for a VO user to reach these options - hopefully this would also mean that the custom action would only have to be added once, instead of duplicating the same code across all the various Timeline Cells.

My only thing now is that I'm really not familiar with Obj-C at all at this time, and so not sure if my above assumptions are actually correct.

robin24 avatar Jul 21 '22 14:07 robin24

a workarround is doubbletap and hold the message with one finger.

bdorer avatar Sep 11 '22 18:09 bdorer