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

Modal fixed position does not work properly when an ancestor has set transform property #453

Closed
hubacekj opened this issue Feb 27, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@hubacekj
Copy link
Contributor

hubacekj commented Feb 27, 2023

Modal's backdrop position: fixed doesn't work properly if its ancestor has set transform property because it then acts as a containing block.

One of the issues with that is when you want to have a Modal inside another Modal, it is positioned relative to the parent Modal instead of the browser viewport. We need to use something else than transform: translate(-50%, -50%) to compensate for width and height of the Modal itself.

@hubacekj hubacekj converted this from a draft issue Feb 27, 2023
@hubacekj hubacekj added the bug Something isn't working label Feb 27, 2023
@hubacekj hubacekj self-assigned this Feb 27, 2023
@hubacekj hubacekj changed the title Modal fixed position does not work properly when an ancestor has transform property Modal fixed position does not work properly when an ancestor has set transform property Feb 27, 2023
@hubacekj
Copy link
Contributor Author

Can @adamkudrna comment on potential solutions?

My take on replacing transform is to use negative margins of half width and height of the Modal itself, which we can get from JS. Not sure of potential issues of this solution such as window resizing, though.

@adamkudrna
Copy link
Member

Hmm, would be interesting to investigate if the problem exists also with the <dialog> element (which I'd like to switch to because of its advantages).

@mbohal mbohal moved this from 🔖 To do to 🏗 In progress in The Board Mar 20, 2023
@hubacekj
Copy link
Contributor Author

Will be solved in #461

@hubacekj hubacekj closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in The Board Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants