This error happened on Chrome Mobile iOS 57. The error was reported from one of the systems, that I take part in developing.
The problem was that there was handleKeyDown function triggered (I think it there might be a virtual keyboard left open when on the iPhone) and then getFocusableElements
Inside this function getModal method is called, which uses getContainer().querySelector(...).
This is where the error was thrown. The DOM element with class swalClasses.container was not found, therefore null is returned from the execution of the getContainer() method and getContainer().querySelector() is invalid.
I can not provide steps to reproduce, because I was not able to reproduce the error either
I think the right solution here is to handle not found container element in the getModal method. All the methods that use it must be updated accordingly to accept null as a result of the execution of getModal().
As I am not familiar with this lib, so I invite you to have a discussion before proceeding with PR :)
I'm encountering the same problem in Chrome 58.0.3029.96 on macOS Sierra.
Able to reproduce it with this:
swal("test");
swal("test2");
swal.close();
// Then press escape
I'm guessing the problem is that the overwritten modal doesn't have its events unbound.
Thanks guys for such a good bug report! I'll handle it asap.
Fixed in v6.6.3
Thanks @dirchev and @brtinney-touchsuite for your help in debugging this issue!
Most helpful comment
I'm encountering the same problem in Chrome 58.0.3029.96 on macOS Sierra.
Able to reproduce it with this:
I'm guessing the problem is that the overwritten modal doesn't have its events unbound.