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)
)
}
}Content copied to clipboard