Components: matDialog : configure the position strategy

Created on 11 Jan 2018  路  5Comments  路  Source: angular/components

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

Ability to configure the position strategy of the CdK overlay created by a matDialog in order to have the backdrop only inside an element (not fullscreen).
This is the same feature as 'parent' property of AngularJS material $mDialog (https://material.angularjs.org/latest/api/service/$mdDialog#mddialog-show-optionsorpreset)

What is the current behavior?

matDialog backdrop is fullscreen

What is the use-case or motivation for changing an existing behavior?

Having multiples dialogs in a page that is specific to a part of the page.

P5 materiadialog feature needs discussion

Most helpful comment

According to the MD spec wording, the dialog is meant to be used for all sorts of stuff, even things like menus for which we have mat-menu or mat-select.

These use a ConnectedPositionStrategy, but they different behavior from what you would expect from a dialog. For example the tab key closes the select overlay and jumps to the next form element and dialogs use FocusTrap.

One good use case for these sort of dialogs with ConnectedPositionStrategy is for drop-downs that have complex layout, not just simple items. Those could be used for things like notification panels or user profile panels where you have more than just a list of items. You can see example of this in the Google Analytics page.

Now that we have a Dialog in the CDK experimental package, a factory that provides the default value could be added, similar to MAT_DIALOG_SCROLL_STRATEGY_PROVIDER. -- Yes, it still has a MAT prefix, even though it is inside a CDK package.

I'll try to submit a PR for a MAT_DIALOG_POSITION_STRATEGY_PROVIDER this week.

All 5 comments

We also could really benefit from this feature. Our angular 5 app supports multiple switchable workspaces (like tabs in a browser). Every workspace could have its own modal dialog open.

At the moment NO dialog lib fits our needs - so we are struggling at this point...

According to the MD spec wording, the dialog is meant to be used for all sorts of stuff, even things like menus for which we have mat-menu or mat-select.

These use a ConnectedPositionStrategy, but they different behavior from what you would expect from a dialog. For example the tab key closes the select overlay and jumps to the next form element and dialogs use FocusTrap.

One good use case for these sort of dialogs with ConnectedPositionStrategy is for drop-downs that have complex layout, not just simple items. Those could be used for things like notification panels or user profile panels where you have more than just a list of items. You can see example of this in the Google Analytics page.

Now that we have a Dialog in the CDK experimental package, a factory that provides the default value could be added, similar to MAT_DIALOG_SCROLL_STRATEGY_PROVIDER. -- Yes, it still has a MAT prefix, even though it is inside a CDK package.

I'll try to submit a PR for a MAT_DIALOG_POSITION_STRATEGY_PROVIDER this week.

I'm interested for this feature too.

Thanks, waiting for some update.

Hi,

Is there any update on the MAT_DIALOG_POSITION_STRATEGY_PROVIDER ?

Hey everyone,

Any news on this feature request?

I have the same issue where we have a multi tabbed application and we do need to have some dialogs inside tabs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lfroment0 picture lfroment0  路  108Comments

jelbourn picture jelbourn  路  94Comments

tyler2cr picture tyler2cr  路  57Comments

jelbourn picture jelbourn  路  171Comments

abdulkareemnalband picture abdulkareemnalband  路  165Comments