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

modal-open class not removed from body element #85

Closed
jkirsch opened this issue Mar 1, 2017 · 4 comments
Closed

modal-open class not removed from body element #85

jkirsch opened this issue Mar 1, 2017 · 4 comments

Comments

@jkirsch
Copy link

jkirsch commented Mar 1, 2017

I repeatedly run into the error that after showing the select dialog, sometime the class "modal-open" stays on the body element.

This seems to be related to a similar issue

https://forum.ionicframework.com/t/modal-not-receiving-touch-events/8025/2

Is there something that could be done in the framework, to trigger this behavior ?

Such as

 $scope.$on('modal.shown',function() {
     setTimeout(function(){
          if( $document[0].body.classList.contains('modal-open')) {
              $document[0].body.classList.remove('modal-open');
          }
      },50);
});
@bianchimro
Copy link
Member

hi @jkirsch , you have a codepen or something else to show the issue?
regards
Mauro

@jkirsch
Copy link
Author

jkirsch commented Mar 1, 2017

Well currently not - I'll look into providing one.

It feels like some race condition on modal dispose - as I can only trigger it sometimes on an Android Phone - never in the browser.
The modal-open class has a pointer-events: none entry thus disregards all touch events

@jkirsch
Copy link
Author

jkirsch commented Mar 1, 2017

Okay,

I think I found the mistake

I declared the modal in the following way

<div class="item item-button-right" ng-click="forward('selectButton')">
  Description: 
   <button class="button button-clear button-dark ion-android-arrow-dropdown" 
           id="selectButton" modal-select ng-model="mydata" options="::values">
	<div class="option">
	  {{option}}
	</div>
   </button>
</div>

As I wanted to have the entire row clickable .. I resorted to a simple click forwarding
angular.element(document.getElementById(elementname)).triggerHandler('click');

But If one now clicked on the button .. actually the modal is triggered twice .. this creates two instances that are conflicting .. leading to sometimes the case of an unhidden modal.

Obviously just moving the modal select up to the parent div fixed everything.

Sorry for the confusion .. so this is a non issue

For reference better solution

<div class="item item-button-right" modal-select ng-model="mydata" options="::values">
	Description: 
	<button class="button button-clear button-dark ion-android-arrow-dropdown"></button>
	<div class="option">
	  {{option}}
	</div>
</div>

@bianchimro
Copy link
Member

@jkirsch thanks for reporting anyway, and for your reference solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants