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

[ui] Fix z-indexing for custom alert provider #20192

Merged

Conversation

clairelin135
Copy link
Contributor

@clairelin135 clairelin135 commented Mar 1, 2024

Previously, in certain situations, error dialogs display underneath their corresponding editor modals.

This PR fixes this issue.

@clairelin135
Copy link
Contributor Author

clairelin135 commented Mar 1, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @clairelin135 and the rest of your teammates on Graphite Graphite

Copy link

github-actions bot commented Mar 1, 2024

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-7idq6mfra-elementl.vercel.app
https://03-01-claire-fix-z-index-custom-alert-provider.components-storybook.dagster-docs.io

Built with commit 671022f.
This pull request is being automatically deployed with vercel-action

Copy link

github-actions bot commented Mar 1, 2024

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-nc6fuwdnz-elementl.vercel.app
https://03-01-claire-fix-z-index-custom-alert-provider.core-storybook.dagster-docs.io

Built with commit 671022f.
This pull request is being automatically deployed with vercel-action

@clairelin135 clairelin135 force-pushed the 03-01-claire/fix-z-index-custom-alert-provider branch from 98eed78 to 7dcf1ff Compare March 1, 2024 19:26
@clairelin135 clairelin135 marked this pull request as ready for review March 1, 2024 19:33
@clairelin135 clairelin135 requested a review from salazarm March 1, 2024 19:38
@salazarm salazarm requested review from hellendag and bengotow March 1, 2024 20:37
@hellendag
Copy link
Member

@clairelin135 Do you have an example of where this happens? I'd be interested to poke at this a bit to understand it better.

I'm always a little uneasy about z-index wars, so if we can find a way to get these dialogs to behave better together without introducing new z-index values, that would be nice. (For instance, let's say we want to show another Dialog via clicking on the contents of one of these custom alerts, without closing the custom alert. The newly opened dialog might sit under the custom alert.)

@salazarm
Copy link
Contributor

salazarm commented Mar 1, 2024

@hellendag The CustomerAlertProvider Dialog is always in the DOM so it ends up being behind other dialogs. This ends up happening in the Alert policy editor when you save an alert and the backend returns an error

@salazarm
Copy link
Contributor

salazarm commented Mar 1, 2024

@hellendag btw I do agree with your z-index wars comment. Hate to see it. What we did at FB was we had a file with z-index constants that acted as the source of truth for how things were ordered.


export const GlobalCustomAlertPortalStyle = createGlobalStyle`
.custom-alert-portal {
z-index: 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets try z-index: 1; here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm if the current value is making them appear beneath editor modals I could see >1 being necessary here - Feels like just about nothing should appear above the alert portal so this might be a case where a superbig number is ok...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bengotow I think currently nothing is setting a z-index but because this dialog renders first it ends being displayed at the bottom. I think as long as nothing is setting a z-index then a value of 1 would be fine but yeah a large value is probably more future proof.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like just about nothing should appear above the alert portal

Yeah, though we use the custom alert for lots of stuff that isn't really alerting. :(


export const GlobalCustomAlertPortalStyle = createGlobalStyle`
.custom-alert-portal {
z-index: 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm if the current value is making them appear beneath editor modals I could see >1 being necessary here - Feels like just about nothing should appear above the alert portal so this might be a case where a superbig number is ok...

@hellendag
Copy link
Member

I guess this is fine, though this is certain to have been a long-standing issue, given how old CustomAlertProvider is.

It would be nice to refactor CustomAlertProvider to avoid keeping the single target portal in the DOM, which (IIRC) is just a remnant of how we used to render dialogs many years ago. I can't think of any real benefit to keeping it that way...

@clairelin135 clairelin135 force-pushed the 03-01-claire/fix-z-index-custom-alert-provider branch from 7dcf1ff to 671022f Compare March 7, 2024 18:46
Copy link

github-actions bot commented Mar 7, 2024

Deploy preview for dagster-university ready!

✅ Preview
https://dagster-university-2dsf85ezx-elementl.vercel.app
https://03-01-claire-fix-z-index-custom-alert-provider.dagster-university.dagster-docs.io

Built with commit 671022f.
This pull request is being automatically deployed with vercel-action

@clairelin135 clairelin135 merged commit e770305 into master Mar 7, 2024
6 checks passed
@clairelin135 clairelin135 deleted the 03-01-claire/fix-z-index-custom-alert-provider branch March 7, 2024 18:58
PedramNavid pushed a commit that referenced this pull request Mar 28, 2024
Previously, in certain situations, error dialogs display underneath
their corresponding editor modals.

This PR fixes this issue.
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

Successfully merging this pull request may close these issues.

4 participants