-
Notifications
You must be signed in to change notification settings - Fork 75
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
fix(modal): use fixed positioning on host to prevent Safari from clipping content in certain layouts #9545
base: dev
Are you sure you want to change the base?
fix(modal): use fixed positioning on host to prevent Safari from clipping content in certain layouts #9545
Conversation
…ping content in certain layouts
* Conditional styles for when Modal is slotted in Shell | ||
*/ | ||
|
||
.container.slotted-in-shell { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these no longer needed? if so, what about the class for slotted-in-shell? We can remove it if not necessary. I think there is a prop as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least based on screenshot tests and shallow, local testing, it doesn't look like these are needed anymore after the modal style tweaks. This could benefit from some additional testing too. cc @geospatialem
Good catch on the prop. I'll take a look. 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to eliminate the prop by dynamically checking if the overflowing container is the document body.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - this could potentially have some impact on consumers because of the variety of ways Modals are placed on a page, would this be good to land in a major release due to the risk?
* Conditional styles for when Modal is slotted in Shell | ||
*/ | ||
|
||
.container.slotted-in-shell { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set these classes for Alert and Sheet as well in Shell. Should we change those components as well and remove the internal props we set for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. Once we successfully move modal
to this pattern, we can look at doing the same for similar components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for future reference: slottedInShell
was renamed to embedded
in #9778.
@@ -129,4 +129,8 @@ slot[name="panel-top"]::slotted(calcite-shell-center-row) { | |||
inset: 0; | |||
} | |||
|
|||
slot[name="modals"]::slotted(calcite-modal) { | |||
position: absolute; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to confirm we don't need the pointer-events
rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointer-events: none
are applied to the modal when closed. Once open, this is set to the default, so I think the shell-slotted override isn't necessary.
inset-0 | ||
flex | ||
items-center | ||
justify-center | ||
overflow-y-hidden | ||
opacity-0 | ||
z-overlay; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we confirm this overlay isn't needed in some complex slot / stack situations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overlay z-index is already applied on the host, so modals should already be on that layer. Do you have any examples of complex stacking we could use for testing?
* adds `@floating-ui/utils` dep
Yeah, I can see this being risky because of all the different modal configurations and changes going into this. Since the associated issue does have a workaround, we could consider this for v3. cc @geospatialem |
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
@@ -18,7 +18,7 @@ | |||
} | |||
|
|||
:host { | |||
@apply absolute flex inset-0 opacity-0 z-overlay; | |||
@apply fixed flex inset-0 opacity-0 z-overlay; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we need to do this for the dialog component as well?
34ec85b
to
4d00d75
Compare
4d00d75
to
a96b827
Compare
Related Issue: #9416
Summary
This restores
modal
's host positioning tofixed
to avoid a Safari bug that causes content to be clipped.Note: screenshot test was not added for this scenario since our testing environment uses Chrome.