-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 Positioning #7532
Comments
I managed to solve this using |
Hey there @rscoates, thanks for reporting! Do you have a link to a reproducible example? |
I believe the root of this is in the fact that your modals don't use React portals… several problems then stem from it… the major one being z-index issues because they don't break out of the html context & stay where rendered. I have solved this on our end by creating a wrapper component that manages the rendering through <body>
…
<div data-cy="modals-root">
<div data-modal-mount="workspace_switch-user-dialog">…</div>
<div data-modal-mount="funds_accounts_overview_create-dialog">…</div>
<div data-modal-mount="funds_accounts_overview_pause-dialog">…</div>
<div data-modal-mount="global_exports-dialog">…</div>
</div>
</body> Is there a specific reason for not using portals on your end? |
I believe we moved away from using React portals because it was introducing some a11y concerns, can't remember the exact issue but there is a relevant discussion with this and dropdown menus (#7565 (comment)) |
What package(s) are you using?
carbon-components
carbon-components-react
Summary
Hi there,
I'm using the React-Carbon library to design a new part of a frontend for a client, and I'm having problems with the positioning of a modal. As you can see in the image below, clicking on the button in the table opens the modal (and makes the 'darkening' div visible), but the position of the modal isn't relative to where the viewer is currently looking. As a result, it looks as if the modal hasn't opened until you scroll up.
I don't know if this is intended behaviour, a bug, or something that I have to override. Grateful for any answers.
Relevant information
The text was updated successfully, but these errors were encountered: