0

SO i have my ionic Popup and upon firing enter button from my laptop keyboard, it resubmits the form from which fired the ionicPopup and refuses to close. why is this so?

$ionicPopup.alert({
  title: ' Required Field!',
  template:'Invalid Email, Organization or Password.!'
})

This was working before, it popups the alert and upon clicking on my laptop keyboard enter key, it closes the popup but now it is not working like that, it keeps refreshing and showing the popup.

Kingsley Simon
  • 2,090
  • 5
  • 38
  • 84

1 Answers1

0

$ionicPopup was likely written for mobile environments first. Looking at their template you can see there's not logic to take focus away and allow enter keys

'<div class="popup-container" ng-class="cssClass">' 
   '<div class="popup">' 
      '<div class="popup-head">' 
        '<h3 class="popup-title" ng-bind-html="title"></h3>' 
        '<h5 class="popup-sub-title" ng-bind-html="subTitle" ng-if="subTitle"></h5>' 
      '</div>' 
  '<div class="popup-body">' 
  '</div>' 
  '<div class="popup-buttons" ng-show="buttons.length">' 
    '<button ng-repeat="button in buttons" ng-click="$buttonTapped(button, $event)" class="button" ng-class="button.type || \'button-default\'" ng-bind-html="button.text"></button>' 
  '</div>' 
'</div>' 
'</div>'

My suggestion (and What I'm working on) is rewriting the popup and adding some logic to 1) steal focus and 2) allow enter key on the button

see https://stackoverflow.com/a/21534977

Community
  • 1
  • 1
Erik
  • 2,782
  • 3
  • 34
  • 64