From 163e8dd76f5962f51bf0fb9a153416a2858819d6 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 03:43:08 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Add=20search=20IME=20?= =?UTF-8?q?action=20to=20keyboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added `KeyboardOptions(imeAction = ImeAction.Search)` to the search `OutlinedTextField` components in `RockMusicRoot.kt` and `RockMusicExperience.kt`. Also documented this UI pattern in `.Jules/palette.md`. Co-authored-by: SayanthRock <202829406+SayanthRock@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ .../com/rockmusic/app/presentation/RockMusicExperience.kt | 4 ++++ .../main/java/com/rockmusic/app/presentation/RockMusicRoot.kt | 3 +++ 3 files changed, 11 insertions(+) diff --git a/.Jules/palette.md b/.Jules/palette.md index d191c5e..0c8acca 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -12,3 +12,7 @@ ## 2024-08-01 - [Add Alt Text to Artwork Images] **Learning:** `AsyncImage` components used for displaying track/album artwork often have `contentDescription = null` by default in lists. Adding dynamic alt text like `contentDescription = "Artwork for ${track.name}"` makes list traversal with screen readers significantly more informative. **Action:** When adding images that provide visual context to list items (like album art), always provide a dynamic `contentDescription` based on the item's title rather than `null`. + +## 2024-08-07 - [Added Keyboard IME Actions to TextFields] +**Learning:** By default, single-line text fields on Android show a generic "Done" or "Enter" action on the soft keyboard. Setting `keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search)` for search inputs provides a clearer visual cue (a search icon) and better aligns with user expectations for search interactions. +**Action:** Always provide appropriate `keyboardOptions` (like `ImeAction.Search`, `ImeAction.Done`, `ImeAction.Go`) for `TextField` and `OutlinedTextField` components based on their context to improve the mobile keyboard experience. diff --git a/app/src/main/java/com/rockmusic/app/presentation/RockMusicExperience.kt b/app/src/main/java/com/rockmusic/app/presentation/RockMusicExperience.kt index bfd1269..cbe5d65 100644 --- a/app/src/main/java/com/rockmusic/app/presentation/RockMusicExperience.kt +++ b/app/src/main/java/com/rockmusic/app/presentation/RockMusicExperience.kt @@ -33,6 +33,7 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Add import androidx.compose.material.icons.rounded.Close @@ -83,6 +84,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -360,6 +362,7 @@ private fun ExperienceHome( }, label = { Text("Search songs or YouTube Music") }, leadingIcon = { Icon(Icons.Rounded.Search, contentDescription = null) }, + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search), trailingIcon = { Row(verticalAlignment = Alignment.CenterVertically) { if (query.isNotBlank()) { @@ -651,6 +654,7 @@ private fun ExperienceLibrary( }, placeholder = { Text("Songs, artists, or albums") }, singleLine = true, + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search), shape = RoundedCornerShape(22.dp), modifier = Modifier.fillMaxWidth(), ) diff --git a/app/src/main/java/com/rockmusic/app/presentation/RockMusicRoot.kt b/app/src/main/java/com/rockmusic/app/presentation/RockMusicRoot.kt index 0fa6b41..5e3f0fb 100644 --- a/app/src/main/java/com/rockmusic/app/presentation/RockMusicRoot.kt +++ b/app/src/main/java/com/rockmusic/app/presentation/RockMusicRoot.kt @@ -35,6 +35,7 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Add import androidx.compose.material.icons.rounded.BlurOn @@ -88,6 +89,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.core.content.ContextCompat @@ -519,6 +521,7 @@ private fun SearchScreen(tracks: List, onPlay: (LocalTrack) -> Unit) }, placeholder = { Text("Songs, artists, albums, podcasts") }, singleLine = true, + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search), shape = RoundedCornerShape(22.dp), modifier = Modifier.fillMaxWidth(), )