Modern Apps git

← Modern-Apps.git

web: size the address bar so its text genuinely fits

Commit
159c6701030cfe6188f7d5d2b94b8a253181906b
Author
Vayun Mathur <[email protected]>
When
2026-11-17 15:02 UTC (18 days ago)
Parents
d73bd6c
The previous change fixed the omnibox height at 36 dp to match
the tab-count circle while keeping bodySmall text. That height
cannot hold the text: a Material outlined field spends 12 dp of
vertical content padding above and below the glyphs, so even
bodySmall (16 sp line height) needs 40 dp, and the address was
clipped and cramped in its own pill.

Size the bar the way Vanadium (Chromium) sizes its omnibox: a
full-width rounded bar with comfortable height in balance with
its text. ChromeControlHeight goes from 36 dp to 48 dp, which
holds bodyMedium (14 sp / 20 sp line height) plus the field's
24 dp of vertical padding with room to breathe, and the display
pill and the editing field both move from bodySmall to
bodyMedium so tapping the bar to edit no longer shrinks the text.
The tab-count circle keeps sharing ChromeControlHeight, so it
grows to the same 48 dp diameter and the row still reads as one
set of equal-height controls inside the 64 dp app-bar row.

Verified with :web:testDevUnitTest and :web:lintDev. The chrome
test now also pins ChromeControlHeight at 48 dp alongside the
existing equal-height / square-circle assertions (356 tests,
0 failures).

Diff

web/src/main/java/com/vayunmathur/web/ui/BrowserChrome.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/BrowserChrome.kt b/web/src/main/java/com/vayunmathur/web/ui/BrowserChrome.ktindex 2aa0f9daef..bff66b111d 100644--- a/web/src/main/java/com/vayunmathur/web/ui/BrowserChrome.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/BrowserChrome.kt@@ -39,13 +39,23 @@ import com.vayunmathur.web.R /**  * Diameter of the circular tab-count indicator, and therefore the  * height of the omnibox beside it: the two chrome controls share one- * size so the bar reads as one row of equal-height controls. This is- * the height the indicator already had (labelLarge line height plus- * its old 8.dp vertical padding), so only the width stops varying- * with the digit count. No shared repo dimension exists for this โ€”- * `library.ui.Spacing` is spacing, not control sizes.+ * size so the bar reads as one row of equal-height controls.+ *+ * Sized like Vanadium's (Chromium's) omnibox: a full-width rounded+ * bar with comfortable height for the text inside it, not a compact+ * chip. The address text is `bodyMedium` (14 sp / 20 sp line height);+ * a Material outlined field spends 12 dp of vertical content padding+ * above and below that text, so the field needs at least+ * 20 + 12 + 12 = 44 dp before the glyphs stop being clipped. 48 dp+ * gives that budget a little breathing room while still fitting the+ * 64 dp top-app-bar row beside the overflow button. The previous+ * 36 dp height could not hold even `bodySmall` (16 sp line height+ * plus the same 24 dp of padding is already 40 dp), so the text was+ * cramped and clipped no matter how it was padded. No shared repo+ * dimension exists for this โ€” `library.ui.Spacing` is spacing, not+ * control sizes.  */-internal val ChromeControlHeight = 36.dp+internal val ChromeControlHeight = 48.dp  @OptIn(ExperimentalMaterial3Api::class) @Composable@@ -147,16 +157,17 @@ private fun DisplayOnlyAddressPill(     modifier: Modifier = Modifier, ) {     // Exactly as tall as the circular tab-count indicator beside it-    // (ChromeControlHeight): the field's container shrinks and its-    // internal vertical padding with it, while the text stays bodySmall-    // at the same size โ€” only padding was spent on the extra height.+    // (ChromeControlHeight, see its doc for the fit arithmetic): at+    // 48 dp the bodyMedium text plus the field's internal vertical+    // padding genuinely fits inside the pill, Vanadium-style, instead+    // of being clipped by a container shorter than its own content.     Box(modifier = modifier) {         OutlinedTextField(             value = fullUrl,             onValueChange = {},             readOnly = true,-            textStyle = MaterialTheme.typography.bodySmall,-            placeholder = { Text(stringResource(R.string.search_or_enter_address), style = MaterialTheme.typography.bodySmall) },+            textStyle = MaterialTheme.typography.bodyMedium,+            placeholder = { Text(stringResource(R.string.search_or_enter_address), style = MaterialTheme.typography.bodyMedium) },             singleLine = true,             shape = RoundedCornerShape(28.dp),             modifier = Modifier.fillMaxWidth().height(ChromeControlHeight)
web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt b/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.ktindex 6681e00a79..56dc02628c 100644--- a/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt@@ -97,8 +97,13 @@ internal fun OmniboxEditor(                             fieldValue = fieldValue.copy(selection = TextRange(0, fieldValue.text.length))                         }                     },-                textStyle = MaterialTheme.typography.bodySmall,-                placeholder = { Text(stringResource(R.string.search_or_enter_address), style = MaterialTheme.typography.bodySmall) },+                // Same text size as the read-only address pill in+                // BrowserChrome, so tapping the bar to edit does not+                // shrink the text under the user's finger. The editing+                // field keeps the Material field's natural height,+                // which holds bodyMedium comfortably.+                textStyle = MaterialTheme.typography.bodyMedium,+                placeholder = { Text(stringResource(R.string.search_or_enter_address), style = MaterialTheme.typography.bodyMedium) },                 leadingIcon = { IconSearch() },                 trailingIcon = if (fieldValue.text.isNotEmpty()) {                     {
web/src/test/java/com/vayunmathur/web/ui/BrowserChromeAndSiteIconTest.kt
diff --git a/web/src/test/java/com/vayunmathur/web/ui/BrowserChromeAndSiteIconTest.kt b/web/src/test/java/com/vayunmathur/web/ui/BrowserChromeAndSiteIconTest.ktindex 37ccb4ee86..492967f866 100644--- a/web/src/test/java/com/vayunmathur/web/ui/BrowserChromeAndSiteIconTest.kt+++ b/web/src/test/java/com/vayunmathur/web/ui/BrowserChromeAndSiteIconTest.kt@@ -7,6 +7,7 @@ import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick+import androidx.compose.ui.unit.dp import com.vayunmathur.web.ui.components.SiteIcon import kotlin.test.Test import kotlin.test.assertTrue@@ -69,6 +70,11 @@ class BrowserChromeAndSiteIconTest {         // (circle) even with a two-digit count.         kotlin.test.assertEquals(tabBounds.height, fieldBounds.height)         kotlin.test.assertEquals(tabBounds.width, tabBounds.height)+        // Vanadium-proportioned bar: tall enough for bodyMedium text+        // (20 sp line height) plus the outlined field's 12+12 dp of+        // vertical content padding, i.e. comfortably above the old+        // 36 dp height that clipped its own text.+        kotlin.test.assertEquals(48.dp, ChromeControlHeight)     }      @Test fun siteIconShowsInitialForLabel() {