t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

Preserving onfocus #668

Open jts04 opened 7 years ago

jts04 commented 7 years ago

I'm currently using Sweetalert with Phaser, game engine.

Phaser works only when it gets focus of window. So there is a problem since Sweetalert change window.onfocus and doesn't restore that.

I guess the solution is simple :

  1. store its previous window.onfocus in constructor
  2. restore window.onfocus to previous version in 'sweetAlert.close' function
alexherbo2 commented 6 years ago

Yep I have the same issue.

When SweetAlert closes, document.activeElement is

<input class="swal-content__input" placeholder>