aurovrata / cf7-grid-layout

A WordPress plugin extension for Contact Form 7 to design responsive grid-layout forms.
https://wordpress.org/plugins/cf7-grid-layout/
GNU General Public License v2.0
6 stars 7 forks source link

IE11-Support #16

Closed uvaPotsdam closed 3 years ago

uvaPotsdam commented 3 years ago

First of all, thanks for the great plugin. We are using it on several of our wordpress projects without any problems.

Unfortunately we now got a user response, that the contact form is throwing an error on IE11. After investigation I found out, you are using the "for ... of" syntax in JavaScript which causes IE11 to throw an error. Any idea on how to get rid of this?

for...of does not seem to be supported by IE11 (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)

Thanks in advances.

glange

aurovrata commented 3 years ago

aarrgh! IE11, the curse of Microshite on developers! There are a couple of places where for...of loops are being used.

is it only the for...of loops that is causing issues?

aurovrata commented 3 years ago

Currently the next major version (5) will be converting all the js into ES6 format and making js more efficient overall for forms.

This evolution will make ie11 completely obsolete. I will keep version 4.x branch for projects that need older browser support, but it will only be maintained for bug fixes and will not have new functionality.

So it's a good idea to start coaxing recalcitrant clients to shift to Edge/Chrome/Firefox browsers

uvaPotsdam commented 3 years ago

Thanks for your response. In our case it was only critical since we used a cache plugin which combined all JS files. An error in this file results in the whole JS code to be invalid. I did specify the JS file from your plugin in the list of files to not include in the combined JS and now everything works fine, except of the thrown error. I did not realize any functional misbehaviour in the forms so I guess we are fine with this.

It seems only the for...of loops are the problem but I do not know, wether IE cuts other errors when finding one.

And yes, you are right about IE11 but there are always some customers especially in specific industries who still have old windows machines in the offices.

Cheers and keep up the good work!

aurovrata commented 3 years ago

It seems only the for...of loops are the problem but I do not know, wether IE cuts other errors when finding one.

the for...of loop is used in the handling of validation errors.

I will change these loops and you can tell me if it works.

In case you have more issues, one way round this problem is to use simple CF7 forms for ie-11 browsers (I assume these are only a small fraction of your users?). The Smart-grid delegates simple CF7 forms (which make no use of any smart-grid functionality) to the CF7 plugin, and therefore does not load any of the resources required for the form.

The down-side is that the CF7 plugin is not very efficient and loads its resources on all pages, even those that don't load cf7 forms.

Can you do away with Smart-grid functionality on ie11 browsers? If so create a form for ie11 and dynamically load it based on the browser agent using do_shortcode()

uvaPotsdam commented 3 years ago

Yes, that should work. I'll give it a try.

aurovrata commented 3 years ago

here is a pre-release v4.7.7

can you manually upgrade your server and let me know if that fixes the issue

uvaPotsdam commented 3 years ago

I installed the version 4.7.7. and unfortunately there are more errors concerning IE11. And even worst IE11 seem to stop when a single error was found so we do not get a list of errors. The next error the IE11 console is showing, is the following:

...function n(t,e=[])...

Expected ')'

I guess, old javascript does not support assigning values to function parameters.

aurovrata commented 3 years ago

Unfortunately I don't have access to ie11. Do you have a browserstack.com account I can use to test the js? I am have already used up my free trial.

I guess, old javascript does not support assigning values to function parameters. makes sense.

I notice you're running the live site, you should get better error notification if you run in WP_DEBUG=true mode which will load the non-minified js files.

aurovrata commented 3 years ago

can you try again with pre-release 4.7.7-rc2

uvaPotsdam commented 3 years ago

Line 869: Same problem with function parameter assigment. I checked the JS file and found some other locations to be fixed es well:

Lines: 882, 965, 974, 1074, 1082, 1116

aurovrata commented 3 years ago

did you try the pre-release Ilinked above? all these have been fixed in RC2.

uvaPotsdam commented 3 years ago

Your are right, it is ONLY line 869 which still causes the error.

aurovrata commented 3 years ago

bummer, somehow missed that one!

fixed in v4.7.8rc1, let me know if you find other errors.

had to release v4.7.7 to fix some other bug raised on the forum.

uvaPotsdam commented 3 years ago

Woohoo, IE11 seems to be satisfied with v.4.7.8rc1. Great work. Thanks a lot.

aurovrata commented 3 years ago

ok, I will release v4.7.8

Great work. Thanks a lot.

worth a couple of beers?