App label announcement upon opening `BottomSheetDialogFragment` with Compose content
Asked Answered
P

0

7

Problem

When opening a BottomSheetDialogFragment, with composable content, and TalkBack enabled, the app label is announced immediately. This is an unexpected and jarring experience for TalkBack users. Ideally announcement of the app label would not occur, which is what happens if the BottomSheetDialogFragment contains XML views.

Reproduction

Setup is as simple as this:

class ComposeBottomSheet : BottomSheetDialogFragment() {
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        setStyle(DialogFragment.STYLE_NORMAL, R.style.Theme_KeyboardExperiments_BottomSheetDialog)
        return ComposeView(requireContext()).apply {
            setContent {
               // Composables...
            }
        }
    }
}

I have a sample project that can reproduce it here. This project was initially created to demonstrate a different bug... but it works here too. In this case the app label is KeyboardExperiments.

Demo

Upon opening the sheet the app label is announced.

Question

How can I skip the announcement of the app label upon opening a BottomSheetDialogFragment with composable content?

Note: We cannot migrate to full Compose yet but that is the most obvious solution here.

Playmate answered 15/3 at 16:18 Comment(1)
Have you tried to fully migrate to Compose?Retinue

© 2022 - 2024 — McMap. All rights reserved.