From a2964431094d0838cf65c2deaa3487515d6906e5 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:36:06 +0000 Subject: [PATCH] make the now playing artist target the whole title block The artist line is a single bodyMedium line, 20dp, well under the 48dp minimum touch target. A 48dp artist-only target cannot fit next to the 32dp title inside the 58dp block without borrowing from the title's bottom edge or from the slider's top padding, so the block itself becomes the target: 58dp and full width, with no layout change and nothing to overlap (the slider keeps its own 20dp of top padding before the track). The trade-off is that tapping the song title now opens the artist too. The test asserts the measured target is at least 48dp, which fails on a 20dp node. --- .../subtracks/ui/playback/NowPlayingScreen.kt | 19 +++++++------------ .../ui/playback/NowPlayingTapsTest.kt | 11 +++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/ui/playback/NowPlayingScreen.kt b/app/src/main/kotlin/com/subtracks/ui/playback/NowPlayingScreen.kt index 9655844c..83541725 100644 --- a/app/src/main/kotlin/com/subtracks/ui/playback/NowPlayingScreen.kt +++ b/app/src/main/kotlin/com/subtracks/ui/playback/NowPlayingScreen.kt @@ -293,8 +293,13 @@ fun NowPlayingScreen( verticalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier + .fillMaxWidth() .padding(top = 12.dp) - .height(titleHeight + 6.dp + subtitleHeight), + .height(titleHeight + 6.dp + subtitleHeight) + .clickable( + enabled = onArtistClick != null, + onClickLabel = "Open artist", + ) { onArtistClick?.invoke() }, ) { Box(Modifier.height(titleHeight), contentAlignment = Alignment.Center) { Text( @@ -304,17 +309,7 @@ fun NowPlayingScreen( modifier = Modifier.basicMarquee(), ) } - Box( - modifier = - Modifier - .fillMaxWidth() - .height(subtitleHeight) - .clickable( - enabled = onArtistClick != null, - onClickLabel = "Open artist", - ) { onArtistClick?.invoke() }, - contentAlignment = Alignment.Center, - ) { + Box(Modifier.height(subtitleHeight), contentAlignment = Alignment.Center) { Text( text = state.item?.artist.orEmpty(), style = subtitleStyle, diff --git a/app/src/test/kotlin/com/subtracks/ui/playback/NowPlayingTapsTest.kt b/app/src/test/kotlin/com/subtracks/ui/playback/NowPlayingTapsTest.kt index d7714969..c9998ee1 100644 --- a/app/src/test/kotlin/com/subtracks/ui/playback/NowPlayingTapsTest.kt +++ b/app/src/test/kotlin/com/subtracks/ui/playback/NowPlayingTapsTest.kt @@ -1,11 +1,14 @@ package com.subtracks.ui.playback import androidx.activity.ComponentActivity +import androidx.compose.ui.test.assertHeightIsAtLeast import androidx.compose.ui.test.assertIsNotEnabled +import androidx.compose.ui.test.assertWidthIsAtLeast import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick +import androidx.compose.ui.unit.dp import androidx.test.ext.junit.runners.AndroidJUnit4 import com.subtracks.data.model.CoverArtRef import com.subtracks.playback.PlaybackState @@ -85,6 +88,14 @@ class NowPlayingTapsTest { assertTrue("the artist name should open the artist", opened) } + @Test + fun theArtistTargetIsAtLeastTheMinimumTouchSize() { + render(onArtistClick = {}) + + composeRule.onNodeWithText("Radiohead").assertHeightIsAtLeast(48.dp) + composeRule.onNodeWithText("Radiohead").assertWidthIsAtLeast(48.dp) + } + @Test fun theTapTargetsStayInertWithoutADestination() { render()