Skip to content

[positioner] Popups land in the wrong place under CSS zoom when the offset parent is the window #6252

Open

Description

@dimitriknight

Version: 1.6.0. The 1.9.0 source has the same positioning code, with no zoom handling.

When an ancestor sets CSS zoom, getBoundingClientRect() returns zoomed viewport pixels. Floating UI divides rects by the scale of an offset parent element, but it treats a window offset parent as unscaled. The top layer, a position: fixed positioner, and a static body all give a window offset parent.

Steps:

  1. Set zoom: 2 on an ancestor of a Popover or Menu.
  2. Open a Popover inside a modal Dialog (top layer), or open a ContextMenu (fixed, no containing block).

Expected: the popup aligns with its anchor or the pointer.

Actual, at zoom 2: a calendar Popover inside a modal Dialog opened 119 px after and below its field. A ContextMenu opened about 720 px from the pointer.

A related case: the shift() limit for the arrow uses the arrow rect and the padding in viewport pixels, but compares them with offset-parent pixels. Without zoom, a Tooltip at the viewport start overlaps its trigger by 12 px. At zoom 2, the same Tooltip overlaps it by 19 px.

We fixed it locally with a platform for useFloating that scales a window offset parent by the zoom of the floating element, and by dividing the arrow limit by the offset parent scale. Without zoom, each result is unchanged. We can open a PR if this direction fits.

Activity

  1. jjenzz commented on Nov 16, 2026

    @jjenzz
    Member

    Thanks for reporting this. With many issues coming in, we’re weighing user benefit against the ongoing cost of each fix.

    ROI review · before implementation

    🟢 Fix — recommended. Proceed with implementation.

    medium confidence — Under CSS zoom, popups land far from their anchor in the default setup. A narrow wrapper on a documented Floating UI hook fixes the cause and is a no-op at zoom 1.

    Existing-API assessment: No public platform option. None tested.

    Consideration Assessment
    Design foundation suitable: The wrapper extends the model Floating UI already uses for element offset parents through its documented platform hook, so it fixes the cause at one point.
    Benefit / reach Apps using CSS zoom. Reach unknown; one search found no other reports. Default Popover, ContextMenu and Dialog cases fail at body zoom 2.
    Severity / workaround Popups render 120 to 480 px from anchor or pointer. No public platform option. None tested.
    Cost / risk Small wrapper, one zoom read per update. Bytes not measured. Wraps a few platform methods and adaptiveOrigin window size. Zoom 1 returns early. Risk: double scaling if Floating UI adds zoom.
    Alternatives / next step Upstream needs a release and bump. Scaling final x and y misses arrow, size and origin. Revisit if Floating UI adds zoom support or the diff grows past wrapper, origin and arrow limiter.

    Affected too? Add a 👍 reaction and tell us how this affects your app. Feedback is welcome. This review can change.


    🤖 Comment posted by Claude

  2. jjenzz commented on Nov 16, 2026

    @jjenzz
    Member

    ROI review · after implementation

    🟢 Fix — recommended. Proceed with implementation.

    high confidence — A small local wrapper fixes popups misplaced under CSS zoom, adds no dependency and returns early at zoom 1.

    Existing-API assessment: No tested workaround; changing zoom or layout affects the app.

    Consideration Assessment
    Design foundation suitable: It uses a documented extension point, fixes every tested window offset parent case, and leaves element offset parents and zoom 1 unchanged.
    Benefit / reach Popups land far from their anchor under CSS zoom. Reach is unknown. Needs ancestor CSS zoom with a window offset parent, like a static body.
    Severity / workaround Several popups were hundreds of pixels off. No tested workaround; changing zoom or layout affects the app.
    Cost / risk Measured diff: 96 changed lines; 0 added dependencies; bundle delta: unmeasured. No added dependencies; bytes not measured. At zoom 1 it reads currentCSSZoom and returns. One 69-line internal file and 7 lines in useFloating; no API change. Low. Only active when zoom is not 1 with a window offset parent.
    Alternatives / next step An upstream patch needs a release; dividing final x and y left the arrow 90 px off. Revisit if Floating UI adds zoom support or the open edge cases are reported.

    Affected too? Add a 👍 reaction and tell us how this affects your app. Feedback is welcome. This review can change.


    🤖 Comment posted by Claude

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions