material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Catalog] Fix CardSelectionModeActivity sample

Open pubiqq opened this issue 3 years ago • 3 comments

Resolves https://github.com/material-components/material-components-android/issues/2716

pubiqq avatar May 24 '22 17:05 pubiqq

The original commit that added this solution/workaround: https://github.com/material-components/material-components-android/commit/a49fa6ab36276a762d46d9f716b4ef8ff5947907

If I understand correctly, SelectionTracker is using RecyclerView.OnItemTouchListener to grab click/long click events. Therefore if the accessibility framework directly send click/long click events, SelectionTracker won't be able to catch them, and that's why we need the workaround at the beginning and we need to keep the behavior.

drchen avatar May 31 '22 16:05 drchen

Unfortunately, this workaround doesn't fulfill its task and makes the situation even worse:

  • Сard selection stopped working in normal use (see #2716).
  • Card selection still doesn't work in TalkBack mode for the same reason.
  • Even if this workaround worked, it would still not match the behavior expected from SelectionTracker. A long click is only needed to enter the selection mode and activate the first item, to activate/deactivate the other elements, a single click should work.

pubiqq avatar Jun 01 '22 18:06 pubiqq

Paul, can you take a look?

drchen avatar Jun 01 '22 18:06 drchen

This just reverts the original change that was made to make (attempt...) the card selection accessible, would be great to find a proper fix instead of just removing it.

paulfthomas avatar Nov 01 '22 18:11 paulfthomas

A proper fix can only be provided by androidx.recyclerview:recyclerview-selection developers. The original solution is correct from a logical point of view, but doesn't work only with Talkback due to some problem with recyclerview-selection. The current solution is a hack and doesn't work correctly at all (neither in normal mode nor in Talkback). That's why I think the current change needs to be reverted.

pubiqq avatar Nov 02 '22 14:11 pubiqq