Set proper offset for closed modal drawer even if uninitialized

In rare cases, the drawer state offset might be NaN when the
drawer is being rendered. In this case, we still want to ensure
closed drawers are rendered offscreen, so we use a default
width value. This offset will get properly updated in a later
layout pass.

Bug: b/355726833
Test: manually tested
Change-Id: I3a5e10be379159b45f74bd5b65ae38dda21ee18a
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
index 6f5dfbc..4ebaa83 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
@@ -380,8 +380,14 @@
             modifier =
                 Modifier.offset {
                         drawerState.currentOffset.let { offset ->
-                            if (offset.isNaN()) IntOffset.Zero
-                            else IntOffset(offset.roundToInt(), 0)
+                            val offsetX =
+                                when {
+                                    !offset.isNaN() -> offset.roundToInt()
+                                    // If offset is NaN, set offset based on open/closed state
+                                    drawerState.isOpen -> 0
+                                    else -> -DrawerDefaults.MaximumDrawerWidth.roundToPx()
+                                }
+                            IntOffset(offsetX, 0)
                         }
                     }
                     .semantics {