fix: ExtendedFloatingActionButton not accessible by screen readers (#2080)

This commit is contained in:
aAbed 2024-08-06 06:31:41 +05:45 committed by GitHub
parent c18901c35b
commit 4257c32bf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 7 deletions

View File

@ -570,7 +570,12 @@ private class ListOptionEditor<T : Serializable>(private val elementEditor: Opti
ExtendedFloatingActionButton( ExtendedFloatingActionButton(
text = { Text(stringResource(R.string.add)) }, text = { Text(stringResource(R.string.add)) },
icon = { Icon(Icons.Outlined.Add, null) }, icon = {
Icon(
Icons.Outlined.Add,
stringResource(R.string.add)
)
},
expanded = lazyListState.isScrollingUp, expanded = lazyListState.isScrollingUp,
onClick = { items.add(Item(null)) } onClick = { items.add(Item(null)) }
) )

View File

@ -162,7 +162,7 @@ fun PatchesSelectorScreen(
if (showSelectionWarning) { if (showSelectionWarning) {
SelectionWarningDialog(onDismiss = { showSelectionWarning = false }) SelectionWarningDialog(onDismiss = { showSelectionWarning = false })
} }
vm.pendingUniversalPatchAction?.let { vm.pendingUniversalPatchAction?.let {
UniversalPatchWarningDialog( UniversalPatchWarningDialog(
onCancel = vm::dismissUniversalPatchWarning, onCancel = vm::dismissUniversalPatchWarning,
onConfirm = vm::confirmUniversalPatchWarning onConfirm = vm::confirmUniversalPatchWarning
@ -295,8 +295,14 @@ fun PatchesSelectorScreen(
ExtendedFloatingActionButton( ExtendedFloatingActionButton(
text = { Text(stringResource(R.string.save)) }, text = { Text(stringResource(R.string.save)) },
icon = { Icon(Icons.Outlined.Save, null) }, icon = {
expanded = patchLazyListStates.getOrNull(pagerState.currentPage)?.isScrollingUp ?: true, Icon(
Icons.Outlined.Save,
stringResource(R.string.save)
)
},
expanded = patchLazyListStates.getOrNull(pagerState.currentPage)?.isScrollingUp
?: true,
onClick = { onClick = {
// TODO: only allow this if all required options have been set. // TODO: only allow this if all required options have been set.
onSave(vm.getCustomSelection(), vm.getOptions()) onSave(vm.getCustomSelection(), vm.getOptions())
@ -566,7 +572,13 @@ private fun OptionsDialog(
if (values == null || !values.contains(key)) option.default else values[key] if (values == null || !values.contains(key)) option.default else values[key]
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
OptionItem(option = option as Option<Any>, value = value, setValue = { set(key, it) }) OptionItem(
option = option as Option<Any>,
value = value,
setValue = {
set(key, it)
}
)
} }
} }
} }

View File

@ -163,7 +163,12 @@ private fun SelectedAppInfoScreen(
floatingActionButton = { floatingActionButton = {
ExtendedFloatingActionButton( ExtendedFloatingActionButton(
text = { Text(stringResource(R.string.patch)) }, text = { Text(stringResource(R.string.patch)) },
icon = { Icon(Icons.Default.AutoFixHigh, null) }, icon = {
Icon(
Icons.Default.AutoFixHigh,
stringResource(R.string.patch)
)
},
onClick = onPatchClick onClick = onPatchClick
) )
} }

View File

@ -83,7 +83,12 @@ fun VersionSelectorScreen(
floatingActionButton = { floatingActionButton = {
ExtendedFloatingActionButton( ExtendedFloatingActionButton(
text = { Text(stringResource(R.string.select_version)) }, text = { Text(stringResource(R.string.select_version)) },
icon = { Icon(Icons.Default.Check, null) }, icon = {
Icon(
Icons.Default.Check,
stringResource(R.string.select_version)
)
},
expanded = lazyListState.isScrollingUp, expanded = lazyListState.isScrollingUp,
onClick = { viewModel.selectedVersion?.let(onAppClick) } onClick = { viewModel.selectedVersion?.let(onAppClick) }
) )