Commit eccd823
fix(layout): correct isLayoutCalculated always returning true (#2642)(by @spsaucier)
* fix(layout): correct isLayoutCalculated always returning true
The `isLayoutCalculated` derived value uses an OR condition to check
whether `containerHeight` has been provided:
if (containerHeight !== null || containerHeight !== undefined)
This expression is always true for any value — if containerHeight is
null, the `!== undefined` branch is true, and vice versa. The intended
check should use AND:
if (containerHeight !== null && containerHeight !== undefined)
Without this fix, `isLayoutCalculated` returns true before layout
measurements complete, allowing `evaluatePosition` to run with
`containerHeight = INITIAL_LAYOUT_VALUE (-999)`. This produces
incorrect detent positions and can cause the sheet's content panel to
animate to an off-screen position while the backdrop renders correctly
(since both are derived from the same animatedPosition, but the
incorrect initial animation target can leave the body off-screen after
the "completed" callback fires and the snap-point-change correction
races with the mount animation).
The second condition (`!== INITIAL_LAYOUT_VALUE`) still serves as the
primary guard, but the first condition should be logically correct so
it doesn't silently pass for null/undefined containerHeight values.
* fix: merged container height logic to avoid early setting to true
---------
Co-authored-by: Stephen Saucier <hulaman345@gmail.com>
Co-authored-by: gorhom <gorhom.dev@gmail.com>1 parent 02f3872 commit eccd823
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
0 commit comments