Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
## 2024-05-18 - Redundant Icon Content Descriptions
**Learning:** Adding `contentDescription` to icons that are directly adjacent to `Text` components containing the same wording is an anti-pattern. Screen readers will announce the information twice (e.g., "Liked, Liked"), creating a noisy experience. Icons in this context should remain decorative (`contentDescription = null`).
**Action:** Verify if text alternatives exist near visual elements before assigning a `contentDescription` to avoid duplicate screen reader announcements.
## 2024-05-19 - Dynamic Icon Content Descriptions
**Learning:** Providing dynamic `contentDescription` strings based on state (e.g., "Unlock rotation" / "Lock rotation") provides clearer context for screen reader users compared to static labels (e.g., "Rotation").
**Action:** Always verify if an icon button has multiple states and apply dynamic `contentDescription` to communicate current state and action clearly.
15 changes: 8 additions & 7 deletions app/src/main/java/com/example/reddittube/ui/main/VideoPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -729,7 +730,7 @@ Box(
.clip(CircleShape)
.background(Color.Black.copy(alpha = 0.65f))
.border(1.dp, GlassBorder, CircleShape)
.clickable {
.clickable(role = Role.Button) {
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
if (exoPlayer.playbackState == Player.STATE_ENDED) {
exoPlayer.seekTo(0)
Expand Down Expand Up @@ -786,7 +787,7 @@ Box(
.size(40.dp)
.clip(CircleShape)
.background(Color.Black.copy(alpha = 0.55f))
.clickable { onBack?.invoke() },
.clickable(role = Role.Button) { onBack?.invoke() },
contentAlignment = Alignment.Center
) {
Icon(Icons.Default.ArrowBack, contentDescription = "Back", tint = Color.White, modifier = Modifier.size(22.dp))
Expand Down Expand Up @@ -877,7 +878,7 @@ Box(
.size(32.dp)
.clip(CircleShape)
.background(BrandRed.copy(alpha = if (isSubbed) 0.2f else 0.15f))
.clickable {
.clickable(role = Role.Button) {
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
onSubscribeToggle(post.subreddit.lowercase())
},
Expand Down Expand Up @@ -988,7 +989,7 @@ Box(
) {
Icon(
if (isRotationLocked) Icons.Default.Lock else Icons.Default.LockOpen,
contentDescription = "Rotation",
contentDescription = if (isRotationLocked) "Unlock rotation" else "Lock rotation",
tint = if (isRotationLocked) BrandRed else Color.White,
modifier = Modifier.size(14.dp)
)
Expand All @@ -1001,7 +1002,7 @@ Box(
) {
Icon(
if (isMuted) Icons.AutoMirrored.Filled.VolumeOff else Icons.AutoMirrored.Filled.VolumeUp,
contentDescription = "Mute",
contentDescription = if (isMuted) "Unmute" else "Mute",
tint = if (isMuted) BrandRed else Color.White,
modifier = Modifier.size(14.dp)
)
Expand All @@ -1017,7 +1018,7 @@ Box(
) {
Icon(
Icons.Default.SkipNext,
contentDescription = "Auto-next",
contentDescription = if (autoNextEnabled) "Disable auto-next" else "Enable auto-next",
tint = if (autoNextEnabled) Color.White else TextMuted,
modifier = Modifier.size(14.dp)
)
Expand All @@ -1034,7 +1035,7 @@ Box(
) {
Icon(
Icons.Default.Repeat,
contentDescription = "Loop video",
contentDescription = if (isLoopEnabled) "Disable loop" else "Enable loop",
tint = if (isLoopEnabled) Color.White else TextMuted,
modifier = Modifier.size(14.dp)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

Expand Down
Loading