Skip to content

useOverlayPosition wrong position when boundary element is set #2874

@RamunasO

Description

@RamunasO

🐛 Bug Report

useOverlayPosition has wrong position when boundary element is set.

🤔 Expected Behavior

It should position overlay correctly.

😯 Current Behavior

Overlay has wrong position.

💁 Possible Solution

Seems like available space and possibly other values are being calculated relative to the body/viewport rather than boundary element. This might only happen if trigger element is within boundary, but not sure.

🔦 Context

In our use case aria overlays need to be fully contained within parent component. Which means portals are attached to that dom node and overlay should be positioned relative to the node.

💻 Code Sample

This is the simplest reproduction I could make based on example in overlay docs.
https://codesandbox.io/s/overlay-position-issue-ysgcsr?file=/src/index.js

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions