Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover Card Content cannot be moved down using alignOffset #3258

Open
Lexachoc opened this issue Nov 27, 2024 · 2 comments
Open

Hover Card Content cannot be moved down using alignOffset #3258

Lexachoc opened this issue Nov 27, 2024 · 2 comments

Comments

@Lexachoc
Copy link

Bug report

Current Behavior

I cannot use alignOffset to shift the content down (when align="end"), it seems that it is limit to the boundary of the trigger.

image

No matter what value I set for alignOffset, the content will stay at the same position.

To reproduce, try to change the alignOffset from 0 to -100, and to -1000, it won't go down anymore when it reaches the bottom edge of trigger.

No idea how to solve this, and would be very grateful for any help!

I want to dynamically display the hover card content in different vertical positions, but it remains in the same position as in the example when I tried to set the alignOffset even smaller (negative value to let it goes down).

Expected behavior

I expect I can use alignOffset to shift the content down as I set it.

Reproducible example

https://codesandbox.io/p/sandbox/radix-hovercardcontent-alignoffset-issue-342tpf?file=%2Fsrc%2FApp.jsx

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-hover-card ^1.1.2
React n/a 18.3.1
Browser Chrome Version 131.0.6778.86 (Official Build) (64-bit)
Assistive tech
Node n/a
npm/yarn
Operating System Win 10 Pro 22H2
@Lexachoc Lexachoc changed the title Unable to move Hover Card Content to down using alignOffset Hover Card Content cannot be moved down using alignOffset Nov 27, 2024
@D33key
Copy link

D33key commented Dec 2, 2024

Have you tried to set avoidCollisions to false?

I suppose it will help, but there's a problem here - the component can get behind the screen.

@Lexachoc
Copy link
Author

Lexachoc commented Dec 4, 2024

@D33key Thank you so much! That works!
Just confused why there is a boundary that prevents it from moving down. If I make the parent div with a large height, say 1000px, the content still doesn't move down until I set avoidCollisions={false} as you suggested.

But really thank you! Now I can move it down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants