Skip to content

[popover] Expose an imperative updatePosition() API for Popover #5347

Description

@FotisVasilopoulos

I'm using Popover with content that can change size after it has opened (for example, a "Show more" button that expands the content).

When the content expands, the popover continues using the position and available height that were calculated when it first opened. As a result, it can overflow the viewport instead of being repositioned or having its available height recomputed.

Floating UI already supports recomputing the position via update(), but I couldn't find a way to trigger this through Base UI's public API.

It would be useful if the imperative handle exposed something like:

handle.updatePosition();

This would allow consumers to request a recomputation after dynamic layout changes such as:

  • Expanding/collapsing sections ("Show more")
  • Async data loading
  • Images loading
  • Virtualized content changing size
  • Content that changes height based on user interaction

Currently the only workaround I've found is to remount the Popover.Positioner (increasing its key), which resets the internal state of the popover content and isn't ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: popoverChanges related to the popover component.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions