A11ySkipListing

data class A11ySkipListing(val listTitle: String, val actionLabel: String, val nextItemFocusRequester: FocusRequester)(source)

Used to skip listing when a list of components is too large

Samples

val listState = rememberLazyListState()
val listItem: List<ImageItem> = listOf(
    ImageItem(painterResource(id = R.drawable.ic_button_danger), "image 1"),
    ImageItem(painterResource(id = R.drawable.ic_button_danger), "image 2"),
    ImageItem(painterResource(id = R.drawable.ic_button_danger), "image 3")
)
val context = LocalContext.current
val a11ySkipListing = A11ySkipListing("Carousel", "Skip listing", remember { FocusRequester() })

SkapaTheme2(isSystemInDarkTheme()) {
    Column(verticalArrangement = Arrangement.SpaceBetween) {
        Carousel(
            count = listItem.size,
            state = listState,
            variant = CarouselVariant.SlideShow,
            dismissParams = null,
            a11ySkipListing = a11ySkipListing
        ) { page ->
            Image(
                modifier = Modifier
                    .clickable { Toast.makeText(context, "Do something", Toast.LENGTH_LONG).show() },
                painter = listItem[page].image,
                contentDescription = listItem[page].contentDes,
                contentScale = ContentScale.FillWidth
            )
        }
        Text(
            text = "Next focusable element",
            modifier = Modifier
                .focusRequester(a11ySkipListing.nextItemFocusRequester)
                .focusable(true)
        )
    }
}

Constructors

Link copied to clipboard
constructor(listTitle: String, actionLabel: String, nextItemFocusRequester: FocusRequester)

Properties

Link copied to clipboard

label of the custom action

Link copied to clipboard

title of the list of component

Link copied to clipboard

Focus requester, assigned to the Item you want to move focus to