Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(context-dialog): Fixes an issue that the scroll container of the …
Browse files Browse the repository at this point in the history
…context-dialog did not properly resize for large content.
  • Loading branch information
ffriedl89 authored and tomheller committed Mar 3, 2021
1 parent b9a7c79 commit 63d06b7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libs/barista-components/context-dialog/src/context-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ export const DT_CONTEXT_DIALOG_CONFIG = new InjectionToken<OverlayConfig>(
'dt-context-dialog-config',
);

const DT_CONTEXT_DIALOG_DEFAULT_MAX_WIDTH = 328;

@Component({
selector: 'dt-context-dialog',
templateUrl: 'context-dialog.html',
Expand Down Expand Up @@ -310,21 +308,24 @@ export class DtContextDialog
scrollStrategy: this._overlay.scrollStrategies.block(),
backdropClass: 'cdk-overlay-transparent-backdrop',
hasBackdrop: true,
maxWidth: DT_CONTEXT_DIALOG_DEFAULT_MAX_WIDTH,
};

const overlayConfig = this._userConfig
? { ...defaultConfig, ...this._userConfig }
: defaultConfig;

const hasFlexibleDimensions =
this._userConfig?.maxWidth === undefined &&
this._userConfig?.maxHeight === undefined;

const positionStrategy = this._overlay
.position()
.flexibleConnectedTo(this._trigger.elementRef)
.withPositions(OVERLAY_POSITIONS)
.setOrigin(this._trigger.elementRef)
// We need to falsify the flexibleDimension here in case a maxWidth is set
// https://github.com/angular/components/blob/master/src/cdk/overlay/position/flexible-connected-position-strategy.ts#L914
.withFlexibleDimensions(overlayConfig.maxWidth === undefined)
.withFlexibleDimensions(hasFlexibleDimensions)
.withPush(false)
.withGrowAfterOpen(false)
.withViewportMargin(0)
Expand Down

0 comments on commit 63d06b7

Please sign in to comment.