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.
This commit is contained in:
austinried
2026-10-04 00:30:00 +00:00
parent 7b1696da5e
commit a296443109
2 changed files with 18 additions and 12 deletions
@@ -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,
@@ -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()