Fixed
Status Update
Comments
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit b01be1f0984e1ae035582524be989edc14b83b42
Author: Max Alfonso-Ying <maxying@google.com>
Date: Fri Apr 05 00:22:27 2024
Improve a11y of editable ExposedDropdownMenus
Updated `Modifier.menuAnchor` to support icons in addition
to text fields. Now takes a parameter for MenuAnchorType
so we can set popup flags accordingly. Also added an enabled
parameter to control if the anchor is enabled.
This means editable EDMs can use 2 menu anchors to
support both flows of typing and direct selection when
a11y services are enabled.
Updated sample to show this usage.
Fixes: b/257209915 , b/308840226
Test: Added unit tests for enabled/disabled menuAnchor. Manual testing with TalkBack
Relnote: "`ExposedDropdownMenuBoxScope` no longer permits subclasses.
Exposed dropdown menus now have a `MenuAnchorType` which
should be passed to `menuAnchor` to support better a11y.
This should be used instead of passing `focusable` to
`ExposedDropdownMenu`, which is now deprecated.
`menuAnchor` has a new parameter to control `enabled` state."
Change-Id: I55ee632daf66ef4df90297350cbff901e26ea446
M compose/material3/benchmark/src/androidTest/java/androidx/compose/material3/benchmark/ExposedDropdownMenuBenchmark.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ExposedDropdownMenuSamples.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.android.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/internal/Strings.android.kt
M compose/material3/material3/src/androidMain/res/values/strings.xml
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/Strings.kt
M compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/internal/Strings.desktop.kt
https://android-review.googlesource.com/3028145
Branch: androidx-main
commit b01be1f0984e1ae035582524be989edc14b83b42
Author: Max Alfonso-Ying <maxying@google.com>
Date: Fri Apr 05 00:22:27 2024
Improve a11y of editable ExposedDropdownMenus
Updated `Modifier.menuAnchor` to support icons in addition
to text fields. Now takes a parameter for MenuAnchorType
so we can set popup flags accordingly. Also added an enabled
parameter to control if the anchor is enabled.
This means editable EDMs can use 2 menu anchors to
support both flows of typing and direct selection when
a11y services are enabled.
Updated sample to show this usage.
Fixes:
Test: Added unit tests for enabled/disabled menuAnchor. Manual testing with TalkBack
Relnote: "`ExposedDropdownMenuBoxScope` no longer permits subclasses.
Exposed dropdown menus now have a `MenuAnchorType` which
should be passed to `menuAnchor` to support better a11y.
This should be used instead of passing `focusable` to
`ExposedDropdownMenu`, which is now deprecated.
`menuAnchor` has a new parameter to control `enabled` state."
Change-Id: I55ee632daf66ef4df90297350cbff901e26ea446
M compose/material3/benchmark/src/androidTest/java/androidx/compose/material3/benchmark/ExposedDropdownMenuBenchmark.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ExposedDropdownMenuSamples.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.android.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/internal/Strings.android.kt
M compose/material3/material3/src/androidMain/res/values/strings.xml
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/Strings.kt
M compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/internal/Strings.desktop.kt
ma...@google.com <ma...@google.com>
na...@google.com <na...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.3.0-alpha05
androidx.compose.material3:material3-android:1.3.0-alpha05
androidx.compose.material3:material3-desktop:1.3.0-alpha05
Description
Jetpack Compose component used: ExposedDropDownMenuBox
Android Studio Build: AI-223.8836.35.2231.10811636
Kotlin version: 1.8.22
Currently ExposedDropDownMenuBox does not allow disabling. If we disable the Textfield/OutlinedTextField, on click of the Box it still opens DropDownMenu. We have workaround for it to pass the empty callback when disabled, but onExpandChange callback should happen when its disabled.
(Created Another issue related to other ADA issues:
Steps to Reproduce or Code Sample to Reproduce:
1. Install app with disable TextField/OutlinedTextField in the ExposedDropDownMenuBox.
2. Click on the ExposedDropDownMenuBox
3. Opens the DropDownMenu
Expected: Should be disabled.
Video link:
Code: This issue can also be replicated using the Material3 Sample code:
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ExposedDropDownADA() {
val options = listOf("Option 1", "Option 2", "Option 3", "Option 4", "Option 5")
var expanded by remember { mutableStateOf(false) }
var selectedOptionText by remember { mutableStateOf(options[0]) }
// We want to react on tap/press on TextField to show menu
ExposedDropdownMenuBox(
modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp),
expanded = expanded,
onExpandedChange = { expanded = !expanded },
) {
OutlinedTextField(
// The `menuAnchor` modifier must be passed to the text field for correctness.
modifier = Modifier.menuAnchor(),
enabled = false,
readOnly = true,
value = selectedOptionText,
onValueChange = {},
label = { Text("Label") },
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
)
ExposedDropdownMenu(
modifier = Modifier.exposedDropdownSize(),
expanded = expanded,
onDismissRequest = { expanded = false },
) {
options.forEachIndexed { index, selectionOption ->
DropdownMenuItem(
text = { Text(selectionOption) },
onClick = {
selectedOptionText = selectionOption
expanded = false
},
contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding,
)
}
}
}
}