Skip to content

Anchored floating content should support fallback sides before clamping #427

Description

@alexstyl

When anchored floating content is placed on a preferred side that does not have enough room, the current behavior appears to keep that side and clamp the final position into the viewport.

This can cause the floating content to overlap the anchor instead of appearing on the opposite side.

Example:

  • preferred side is Start
  • the anchor is already close to the left edge
  • instead of placing the content on End, the content is clamped into the window and ends up covering the anchor

This is especially noticeable for tooltips, menus, and other anchored surfaces where overlap looks incorrect.

A better default would be:

  1. compute the preferred placement
  2. if it does not fit on the requested side, try the opposite side
  3. if multiple candidates are possible, choose the one with the least overflow
  4. only clamp as a last resort after selecting the best side

It would also be useful if this behavior were configurable, for example:

  • keep current clamp-only behavior
  • allow automatic fallback to opposite side
  • optionally provide a list of fallback sides

That would make anchored positioning behave more like expected floating UI placement near viewport edges.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions