-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(dialog): improved handling of scrollable content #9236
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
base: main
Are you sure you want to change the base?
Conversation
8ee04db to
214f719
Compare
| this._savePreviouslyFocusedElement(); | ||
| return this._portalOutlet.attachComponentPortal(portal); | ||
|
|
||
| const componentRef = this._portalOutlet.attachComponentPortal(portal); |
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.
Add a comment here that explains why this extra class is added?
| @@ -1 +1,3 @@ | |||
| <ng-template cdkPortalOutlet></ng-template> | |||
| <div class="mat-dialog-component-host"> | |||
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 this class meant to be both in the template and added manually?
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.
Yeah, we need to add it through both to cover both template and dialog portals. The class is used to propagate the max-height down correctly since we've got a lot of nested divs.
|
|
||
| /** Max-height of the dialog. If a number is provided, pixel units are assumed. */ | ||
| maxHeight?: number | string; | ||
| maxHeight?: number | string = '80vh'; |
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.
Was this 65vh before? If so, we probably would need to keep the same max-height until a major version change
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.
It wasn't, it was the scrollable content that was 65vh, this applies the height to the overlay pane itself.
src/lib/dialog/dialog.scss
Outdated
| justify-content: center; | ||
| width: 100%; | ||
| flex-shrink: 0; | ||
| order: 1; |
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.
Wouldn't specifying the order take away the ability to put custom content in between the regions?
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 suppose that it would, but the assumption is that if they're using the content element, they're putting all their content into it. I'm fine with removing it though, we haven't had it until now.
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.
If the only reason would be to let people put the dialog directives in any order, I'd rather omit it to give people control in case they need to do something special
214f719 to
fb4dbf0
Compare
|
Addressed the feedback @jelbourn. |
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.
LGTM
fb4dbf0 to
67ab3e9
Compare
67ab3e9 to
2a31c21
Compare
|
Looking forward to this merge! |
2a31c21 to
2c65285
Compare
2c65285 to
3c45bee
Compare
|
Great work on this PR! I am really looking forward to this enhancement as well. It looks like the only reason it hasn't been merged in yet is because the Travis CI build failed due to server issues. Can someone please re-run the build? Thanks! |
|
What are the presubmit failures that are keeping this from being merged? |
|
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
3c45bee to
0297e10
Compare
0297e10 to
d0ebb1e
Compare
|
This fix will be very helpful. Any updates on the PR? |
|
@crisbeto is this PR going to happen? |
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars. * Uses flexbox to ensure that the dialog content elements are always at the appropriate size. Fixes angular#2481. Fixes angular#3239. Fixes angular#6584. Fixes angular#8493.
cc3ba6f to
dccfb41
Compare
|
This PR would fix major problems I'm having using MatDialog, any updates? |
|
What is the status of this PR? When will it be completed. |
|
@jelbourn is this still blocked? |
|
Yes- we haven't work on this since the last update. At this point, we'll probably see if we can address this as part of our work on integrating MDC-web into the components. |
|
@jelbourn have you had a chance to find out whether integrating MDC-web into the components will solve the problems that this PR intended to solve? |
|
@crisbeto is this something you've looked at for the mdc dialog? |
|
I haven't looked into the MDC dialog since somebody else implemented it. |
|
@crisbeto Looks like this PR has fallen out of date, can you please rebase the PR. |
|
Hope this PR is not abandoned and will be merged someday |
mat-dialog-contentby using flexbox, rather than a hardcodedmax-height, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.Fixes #2481.
Fixes #3239.
Fixes #6584.
Fixes #8493.