[combobox] Expose animation-frame positioning for popups opened during an animated Dialog
Summary A Combobox opened immediately inside a Dialog whose enter animation changes transform or scale can emit:
ResizeObserver loop completed with undelivered notifications.
Reproduction
<Dialog.Root defaultOpen>
<Dialog.Portal>
<Dialog.Backdrop />
<Dialog.Popup className="dialog-enter">
<Combobox.Root defaultOpen items={["One"]}>
<Combobox.Input />
<Combobox.Portal>
<Combobox.Positioner>
<Combobox.Popup>
<Combobox.List>
<Combobox.Item value="One">One</Combobox.Item>
</Combobox.List>
</Combobox.Popup>
</Combobox.Positioner>
</Combobox.Portal>
</Combobox.Root>
</Dialog.Popup>
</Dialog.Portal>
</Dialog.Root>.dialog-enter {
animation: enter 250ms ease-out both;
}
@keyframes enter {
from { opacity: 0; transform: translateY(8px) scale(.96); }
to { opacity: 1; transform: translateY(0) scale(1); }
}Open the page; the error is reported through window error while the enter animation runs.
Cause useAnchorPositioning passes only elementResize and layoutShift to Floating UI's autoUpdate:
- v1.4.1: packages/react/src/utils/useAnchorPositioning.ts L412-418;
- still the same in 1.5.0, 1.6.0 and 1.7.0;
- 1.8.0 adds only ancestorScroll.
The ResizeObserver-triggered update writes position and size variables while the Dialog is still changing geometry, which feeds back into the observer.
Floating UI documents animationFrame: true for exactly this case (transformed or animated references): https://floating-ui.com/docs/autoupdate. Base UI does not expose it.
Related, but not the same: #3911, #4383 (menu positioning during animation), #4534 (moving virtual anchors), #5347 (imperative updates).
Proposal
Expose a positioner-level update strategy for anchored popups, for example updatePositionStrategy="optimized" | "always", where always enables autoUpdate(…, { animationFrame: true }). That mirrors Radix's updatePositionStrategy. A narrowly typed autoUpdateOptions passthrough would also work. It should apply to Combobox and the other anchored popup positioners.
Happy to open a PR if the API direction is acceptable.
Source: mui/base-ui