diff --git a/src/en/mobile/android/development/focus-navigation.md b/src/en/mobile/android/development/focus-navigation.md index 1ae52c6b4..7249a7fb1 100644 --- a/src/en/mobile/android/development/focus-navigation.md +++ b/src/en/mobile/android/development/focus-navigation.md @@ -46,6 +46,38 @@ Example of a selector including the `state_focused` : <item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/draw_selected_pressed_selector" /> </selector> +
+
+// Avec Jetpack Compose
+@Composable
+fun CustomDrawableSelector(
+    isFocused: Boolean,
+    isSelected: Boolean,
+    isPressed: Boolean
+) {
+    val drawableRes = when {
+        !isFocused && !isSelected && !isPressed -> R.drawable.draw_unselected_selector
+        !isFocused && isSelected && !isPressed -> R.drawable.draw_selected_selector
+        isFocused && !isSelected && !isPressed -> R.drawable.draw_unselected_focused_selector
+        isFocused && isSelected && !isPressed -> R.drawable.draw_selected_focused_selector
+        !isFocused && !isSelected && isPressed -> R.drawable.draw_unselected_pressed_selector
+        !isFocused && isSelected && isPressed -> R.drawable.draw_selected_pressed_selector
+        isFocused && !isSelected && isPressed -> R.drawable.draw_unselected_pressed_selector
+        isFocused && isSelected && isPressed -> R.drawable.draw_selected_pressed_selector
+        else -> R.drawable.draw_unselected_selector // Default fallback
+    }
+
+    Image(
+        painter = painterResource(id = drawableRes),
+        contentDescription = null,
+        modifier = Modifier
+            .size(48.dp) // Adjust size as needed
+    )
+}
+
+
+
+ Example of a focusable view with keyboard navigation
<View android:focusable="true"
               android:layout_width="0px"
@@ -57,7 +89,6 @@ Example of a view that is not focusable with keyboard navigation but focusable w
               android:layout_width="0px"
               android:layout_height="0px" />
- **WCAG reference:** - 2.1.1 Keyboard - 4.1.2 Name, Role, Value diff --git a/src/en/mobile/android/development/vocal-navigation.md b/src/en/mobile/android/development/vocal-navigation.md index 9252c857e..9c006d789 100644 --- a/src/en/mobile/android/development/vocal-navigation.md +++ b/src/en/mobile/android/development/vocal-navigation.md @@ -360,6 +360,20 @@ It is common to test the Android version before triggering TalkBack vocalization android:accessibilityLiveRegion="polite" /> +**Example with jetpackcompose**: + +
+@Composable
+fun PoliteAccessibilityRegion() {
+Column {
+Text(
+text = "Contenu mis à jour pour l'accessibilité",
+modifier = Modifier.accessibilityLiveRegion(AccessibilityLiveRegion.Polite)
+)
+}
+}
+
+ ## Do not vocalize the decorative and hidden elements.