material icon indicating copy to clipboard operation
material copied to clipboard

md-dialog not closing anymore

Open kschwidder opened this issue 11 years ago • 28 comments

With the latest HEAD the md-dialog does not close anymore. it works in 0.11.3

md-background is hidden but dialog still stays.

kschwidder avatar Oct 15 '15 20:10 kschwidder

I am unable to reproduce this in our docs; please provide more details.

ThomasBurleson avatar Oct 15 '15 20:10 ThomasBurleson

@ThomasBurleson: I have nailed it down more precisely:

  1. animation is disabled.
  2. dialog opacity is set to 0 and the dialog is not visible anymore (as reported once by myself)

In our app we are using menus which are triggering dialogs via directives as follows:

a)

<md-menu access-control resource="Project" operation="UPDATE,DELETE" owner="{{oid}}">
  <div aria-label="Menu"
       class="md-icon-button"
       ng-click="$mdOpenMenu()">
    <img class="pointer"
         ng-src="template/icons/view/ic_arrow_drop_down_grey600_24dp.png">
  </div>
  <md-menu-content>
    <md-menu-item access-control resource="Project" operation="UPDATE">
      <md-button resource="Project" operation="UPDATE" project-member-workflow="member"
                 aria-label="User prozess" ng-click="" member="user">
        <img src="template/icons/view/ic_create_grey600_24dp.png">
        {{'STANDARD_BTN_PROCESS'| translate}}
      </md-button>
    </md-menu-item>
    <md-divider access-control resource="Project" operation="DELETE"></md-divider>
    <md-menu-item access-control resource="Project" operation="DELETE">
      <md-button resource="Project" operation="DELETE" delete-match-member="member" ng-click="" aria-label="undo user"
                 member="user">
        <img src="template/icons/view/ic_delete_grey600_24dp.png">{{'STANDARD_BTN_DELETE'
        | translate}}
      </md-button>
    </md-menu-item>
  </md-menu-content>
</md-menu>

b) the directive triggers the dialog as follows:

$mdDialog.show({
     controller: myController,
     templateUrl: 'app/module/mod_project/views/dialog.project.customer.edit.tpl.html',
     targetEvent: event,
     clickOutsideToClose: false,
     escapeToClose: false,
     bindToController: true,
     locals: {object: localCopy}
 }).then(onUpdate, onAbort);

Problem is the following:

  1. When disabling animation the dialog is not shown since opacity is 0
  2. When animation is enabled dialog it is shown but weired behaviour...

in 0.11.4 it works well but HEAD does not.

kschwidder avatar Oct 16 '15 06:10 kschwidder

@EladBezalel - did we break something with our recent Dialog openFrom-, closeTo- features?

ThomasBurleson avatar Oct 16 '15 08:10 ThomasBurleson

@ThomasBurleson nope, but I investigated this issue before, I will take a look.

EladBezalel avatar Oct 16 '15 11:10 EladBezalel

@kschwidder works on both demos Basic, Open From Close To

maybe something in your code? can you post it on CodePen please?

EladBezalel avatar Oct 17 '15 20:10 EladBezalel

@EladBezalel Just ran into this myself when the button that opened the menu was no longer visible via transform: scale(0).

Here is a codepen: https://codepen.io/topherfangio/pen/GpOyyg

Important note: if the button becomes immediately invisible (instead of waiting for the transition time), the dialog never appears either.

topherfangio avatar Oct 18 '15 03:10 topherfangio

@topherfangio awesome! Thanks :)

EladBezalel avatar Oct 18 '15 04:10 EladBezalel

@topherfangio @EladBezalel : :+1: This is exactly what happens in my cases !

  1. the dialog never appears sometimes which might be the button case as mentioned
  2. The dialog can not be closed as described.

I have to apologize my possible documentation inconvenience from a user perspective as I am not so deeply involved into internals of the library. What I frequently do is to report errors if our productive app if not behaving correctly as before :-)

Thx to all of your support. You are doing a great job !!!

kschwidder avatar Oct 18 '15 07:10 kschwidder

@kschwidder thank you, your input is very helpful!

EladBezalel avatar Oct 18 '15 19:10 EladBezalel

Has this been already committed in HEAD ? I checked and the problem still exists...

kschwidder avatar Oct 18 '15 20:10 kschwidder

It seems so, can you please post a codepen so we could investigate it more deeply?

EladBezalel avatar Oct 18 '15 21:10 EladBezalel

will try to provide one tomorrow.

@EladBezalel : http://codepen.io/anon/pen/XmzPNV

Last menu Item hangs still the dialog. In this case a directive is triggered on the click event. This works well upto 0.11.4 !

In addition the case of the "important note" of @topherfangio still exists

kschwidder avatar Oct 18 '15 21:10 kschwidder

don't know if this helps but I am experiencing the same issue with confirm dialogs. It only occurs if the dialog is called as the result of an action on ng-click on an md-menu item.

hodeyp avatar Oct 19 '15 22:10 hodeyp

+1. I'm triggering a dialog from a sidenav. It won't close.

websirnik avatar Oct 20 '15 18:10 websirnik

Fixed in b69551c

The problem occurs because the menu item that opened the dialog is not visible anymore when the dialog tries to close.

on 71e23e5 i added openFrom, closeTo options that made specifically for this issue, you should specify at lease closeTo element and the dialog will be opened from the selected menu item and be closed to the menu open button.

EladBezalel avatar Oct 21 '15 21:10 EladBezalel

Latest HEAD does not solve the issue. Is it already committed ?

kschwidder avatar Oct 22 '15 13:10 kschwidder

Not yet, waiting for #5302

EladBezalel avatar Oct 22 '15 14:10 EladBezalel

+1 It seems dialogs don't close when opened from a menu. Not setting targetEvent on the dialog works around it, but of course loses the nice animation.

ghost avatar Oct 23 '15 15:10 ghost

@bluebirdtech the problem there is that the menu is closed when the dialog tries to go back the place he came from (menu item), the beautiful solution is to use the closeTo property and set the menu trigger as the element

EladBezalel avatar Oct 23 '15 16:10 EladBezalel

This should be documented in the changelog as a breaking change.

jb29 avatar Oct 27 '15 14:10 jb29