Besides the problem in the title, Modals works pretty different in J4 overall.
In part due to differences in the J4 code and handling of things.
That said upgrading to J4 and using Modals will cost you a decent amount of time to get it all working like in your J3 setup. If that is possible at all. So I have to say goodbye to Modals (for now). 🙁