Let the session drawer expand to the screen's left edge (#3691)

Keep the resize grip usable at full width and reserve its touch area from Android Back gestures.
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-12-04 09:22:27 -05:00
1 parent ecbda604e2
commit ed763ecb9b
1 file changed
+5 -3
@@ -84,6 +84,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.systemGestureExclusion
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.rememberScrollState
@@ -548,8 +549,8 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
}
androidx.compose.foundation.layout.BoxWithConstraints(modifier = Modifier.fillMaxSize().exposeTestTags(), contentAlignment = Alignment.CenterEnd) {
val short = maxHeight < 440.dp
// The handle keeps a strip on the left free, so a sheet dragged wide can always be dragged back.
val maxSheet = (maxWidth - DRAWER_EDGE_GAP).coerceAtLeast(0.dp)
// At full width the handle's strip sits on the screen's left edge, so the sheet can still be dragged back.
val maxSheet = (maxWidth - DRAWER_HANDLE_STRIP).coerceAtLeast(0.dp)
val minSheet = minOf(DRAWER_MIN_WIDTH, maxSheet)
val defaultSheet = minOf(420.dp, maxWidth * 0.92f)
val sheetWidth = if (docked) maxWidth else (savedWidth?.dp ?: defaultSheet).coerceIn(minSheet, maxSheet)
@@ -1556,7 +1557,6 @@ internal fun secondScreenModes(none: Boolean, deckPad: Boolean, dashboard: Boole
private val DRAWER_MIN_WIDTH = 300.dp
private val DRAWER_HANDLE_STRIP = 24.dp
private val DRAWER_EDGE_GAP = 80.dp
/** A grip on the sheet's left edge: dragging it, or pressing left and right on a controller, resizes the sheet. */
@Composable
@@ -1578,6 +1578,8 @@ private fun DrawerResizeHandle(width: Dp, min: Dp, max: Dp, onWidth: (Dp) -> Uni
contentAlignment = Alignment.Center,
modifier = modifier.width(24.dp).height(96.dp)
.onGloballyPositioned { coords = it }
// On the screen's edge, Android's back swipe would take the drag.
.systemGestureExclusion()
.focusable(true, source)
.onPreviewKeyEvent { event ->
val key = event.nativeKeyEvent