ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

perf: Modal remove unnecessarily calls ionicClickBlock

Open MartinMa opened this issue 11 years ago • 22 comments

Type: perf

Platform: all

Upon removal of an Ionic modal the method ionicModal#hide is always called (Even when no modal is visible). It shows the click-block div for a short amount of time by calling $ionicClickBlock.show(600);.

This breaks the responsiveness of the app for a short amount of time, because it can't receive any touch or mousedown events.

MartinMa avatar Sep 18 '15 13:09 MartinMa

Greetings @MartinMa!

I've closed this issue because my sensors indicated it was old and inactive, and may have already been fixed in recent versions of Ionic. However, if you are still experiencing this issue, please feel free to reopen this issue by creating a new one, and include any examples and other necessary information, so that we can look into it further.

Thank you for allowing me to assist you.

Ionitron avatar Dec 17 '15 20:12 Ionitron

This issue is still present. @mlynch please take a few minutes and check the referenced pull request I provided three month ago. It's a very easy fix with a huge impact, if you frequently remove and add Ionic modals. Thanks.

MartinMa avatar Dec 17 '15 20:12 MartinMa

@tlancina You introduced the "prevent ghost clicks on close" fix for modals here a416c66d8aede50fcf91cc569681a6d163e37cbc. But the problem is, that the "click block div" also appears, when removing the modal while it is hidden. I think, there is no need to show a click block div, when removing a hidden modal. It affects responsiveness.

MartinMa avatar Dec 17 '15 20:12 MartinMa

I have also an issue with the $ionicClickBlock hidden the content view or the modal itself.

ceoaliongroo avatar Jan 12 '16 09:01 ceoaliongroo

Apologies for this one slipping through through the cracks! Re-opening.

tlancina avatar Jan 13 '16 04:01 tlancina

@tlancina Thanks.

@ceoaliongroo I think it is unwise to just remove the $ionicClickBlock call. It probably has its purpose. If it has been proven that these "ghost clicks" only appear on iOS, it may be wrapped in a check for ionic.Platform.isIOS.

But this issue focused on ionicModal#remove, that indirectly triggers a click-block-div, even when the modal was already hidden.

MartinMa avatar Jan 13 '16 08:01 MartinMa

I understood, also the intention is to keep it. But the implementation have to be improved, now is not clear what issue was solved, there is not test, as ins not clear how affect.

I my opinion we need to do

  • Code the missing test scripts for the "ghost clicks" (I did found it)
  • If is only in iOS, i suggest to create a separe service, and then filter the execution using ionicPlatform

In my case the issue appear also, on a new modal, i think also is related with the animation configuration. But still not clear.

Also, i'll going to check ionicModal#remove

thanks

ceoaliongroo avatar Jan 13 '16 09:01 ceoaliongroo

I also have the same problem, after the modal disappears, I have to wait for the complete time of the fade out animation before I can click underlying elements again :( any quick fix for this?

Freundschaft avatar Feb 08 '16 10:02 Freundschaft

You will have to create your own animation css class to increase the transition time, so it will have time enough to do the ionicClickBlockstuff(basically it deletes and adds the click-block-hide class but it takes time, 700ms roughly). Also, there's a ionicModalproperty called hideDelay(it's not in the docs), use it to simulate the time it takes to hide the modal(I use 100ms less than transition). This workaround should do it.

danotrino avatar Mar 09 '16 14:03 danotrino

Hello! Are you still experiencing this issue?

jgw96 avatar Mar 23 '16 19:03 jgw96

Hello! Thanks for opening an issue with us! Since it has been a little while since there was any activity on this issue i will be closing it, but feel free to respond back if your still having the issue! Thanks again!

jgw96 avatar Mar 28 '16 16:03 jgw96

This is still an issue. Please re-open and address the click-block issue. Our company uses Ionic and we recently experienced an issue where the click-block div does not remove itself when destroying a modal.

cory-buckley avatar Apr 13 '16 17:04 cory-buckley

Hey @solarsaturn9 ! Would you be able to make a plunker that demonstrates this issue please? Here is a template you can use: http://plnkr.co/edit/jnOrQRtE8rN2WCXDQYQY?p=info

jgw96 avatar Apr 13 '16 17:04 jgw96

This is the issue I'm referring to http://plnkr.co/edit/q1LuChLrrO15cjMz7EJN?p=preview

cory-buckley avatar Apr 13 '16 20:04 cory-buckley

The problem is that Ionic modal always calls hide() in direct consequence of calling remove. And hide() activates the click-block-div. But Ionic doesn't need to call hide(), when the modal is already hidden. Do you see what I mean? When it is already hidden, Ionic can just go ahead and remove it. This is what I'm trying to explain for a few month now. ;)

@solarsaturn9 In your case remove() triggers another hide() and your event handler triggers remove() again an so on. It's a vicious circle. hide_to_infinity Since every call to hide activates the click-block-div, it just stays there forever.

The fix is easy. I'll propose a pull request.

MartinMa avatar Apr 14 '16 07:04 MartinMa

@MartinMa, can you show me an example of the problem we're trying to solve in a code pen or plunkr? Or does @solarsaturn9's plunkr demonstrate it adequately?

Thanks, Dan

danbucholtz avatar Apr 15 '16 17:04 danbucholtz

@danbucholtz The plunker demonstrates part of the problem. Just add the console.log bit (see screenshot) and you'll see the problem of Ionic (in the console). This issue doesn't need a plunker. It's fairly simple to understand, when you look at the code.

Apart from that, I don't know what to say anymore. I feel like repeating myself all the time. I explained it multiple times now. I filed the issue back in September of 2015. In the meantime it has been closed twice for no reason. I have been very patient.

Please take a look at the pull request and you'll see what I mean. I'm just trying to help, but this is frustrating.

MartinMa avatar Apr 15 '16 18:04 MartinMa

@MartinMa, we understand your frustration. Please understand that we get 100s of issues per week that we have to go through, so it is hard to keep up. It can often take 100s of hours per week. It isn't always clear what a PR/issue is attempting to convey. It is much easier to understand an issue and resolve it when there is an extremely dumbed down codepen example and step by step instructions. Remember, you know your app and use cases, we don't.

What I am trying to understand is this:

"Upon removal of an Ionic modal the method ionicModal#hide is always called (Even when no modal is visible)"

Why would you call hide when there isn't a modal visible? I don't understand the use case. Is this issue resolved by simply not calling hide on a modal that isn't displayed?

Please let me know and thank you for contribution.

Thanks, Dan

danbucholtz avatar Apr 15 '16 18:04 danbucholtz

I believe @MartinMa has stated the problem perfectly. I think he is saying that Ionic is calling ionicModal#hide while it is going through the process of removing a modal. Its not a matter of use cases. I think your confusion lies in the fact that we are referring to two different things: a hidden modal and a removed modal. Removed modal is a modal that has been completely destroyed, not hidden.

cory-buckley avatar Apr 15 '16 19:04 cory-buckley

Hi @solarsaturn9, thanks for the explanation. I will take a look.

Thanks, Dan

danbucholtz avatar Apr 15 '16 19:04 danbucholtz