ebarrenechea / header-decor

A couple of sticky header decorations for android's recycler view.
Apache License 2.0
879 stars 159 forks source link

Header is not read by TalkBack #73

Open desamtralized opened 7 years ago

desamtralized commented 7 years ago

Hello, I'm using this library in a project that requires accessibility. When using the TalkBack in a screen with "sticky headers" the headers can't be read or focused by the TalkBack (or accessibility inspector?).

Is there any workaround?

Thanks in advance.

vr49 commented 7 years ago

Are you able to get the focus ?

yuvalldb commented 6 years ago

Any solution?

starkej2 commented 6 years ago

I haven't had a chance to look into this issue yet, but a pull request would be welcome if you find a solution!

starkej2 commented 6 years ago

Until a better solution is determined, a decent workaround would be to implement an item touch listener as described in #38, then when the header is clicked you can manually send an accessibility announcement by doing something like this:

AccessibilityManager accessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);

if (accessibilityManager != null && accessibilityManager.isEnabled()) {
    AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT);
    event.getText().add("some text");
    view.onInitializeAccessibilityEvent(event);
    view.getParent().requestSendAccessibilityEvent(view, event);
}

It would be really cool if there was also the option to read the headers when they stick to the top of the screen...but I don't think that's possible at the moment.