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

fix(cdk/overlay): fix wrong overflow calculation #17791

Merged
merged 3 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {

// Determine how much the overlay goes outside the viewport on each
// side, which we'll use to decide which direction to push it.
const overflowRight = Math.max(start.x + overlay.width - viewport.right, 0);
const overflowBottom = Math.max(start.y + overlay.height - viewport.bottom, 0);
const overflowRight = Math.max(start.x + overlay.width - viewport.width, 0);
const overflowBottom = Math.max(start.y + overlay.height - viewport.height, 0);
const overflowTop = Math.max(viewport.top - scrollPosition.top - start.y, 0);
const overflowLeft = Math.max(viewport.left - scrollPosition.left - start.x, 0);

Expand Down
16 changes: 13 additions & 3 deletions src/material-experimental/popover-edit/popover-edit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ElementDataSource extends DataSource<PeriodicElement> {

@Component({
template: `
<div #table style="margin: 16px">
<div #table style="margin: 16px; max-width: 90vw; max-height: 90vh;">
<mat-table editable [dataSource]="dataSource">
<ng-container matColumnDef="before">
<mat-cell *matCellDef="let element">
Expand Down Expand Up @@ -219,7 +219,12 @@ class ElementDataSource extends DataSource<PeriodicElement> {
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
</div>
`
`,
styles: [`
mat-table {
margin: 16px;
}
`]
})
class MatFlexTableInCell extends BaseTestComponent {
displayedColumns = ['before', 'name', 'weight'];
Expand Down Expand Up @@ -265,7 +270,12 @@ class MatFlexTableInCell extends BaseTestComponent {
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<div>
`
`,
styles: [`
table {
margin: 16px;
}
`]
})
class MatTableInCell extends BaseTestComponent {
displayedColumns = ['before', 'name', 'weight'];
Expand Down