ghosh / Micromodal

⭕ Tiny javascript library for creating accessible modal dialogs
https://micromodal.now.sh/
MIT License
3.54k stars 230 forks source link

IE 11: Syntax error #246

Closed jhof-nc closed 4 years ago

jhof-nc commented 5 years ago

Hello,

Thank you for the great library for accessibility. We are happy users, but today after CDN went unavailable, MicroModal library gets "Syntax error" in IE 11 and as a result, the JS library is not imported. It is crucial for our business to run this library on IE 11.

We get the error on character/column 202. Is there anything you can do to fix this? By the way, my browser says that are emojis of exclamation mark in the JS script. Is this true and can this contribute to the error?

image

We use v 0.4.2. Thanks for help.

ghosh commented 5 years ago

I'm not sure if this error was introduced with this update. Can you please check if it works with 0.4.0?

BrunoFenzl commented 5 years ago

I can confirm this error in IE11 with micromodal 0.4.2. The error happens because of the arrow functions.

vives927 commented 5 years ago

I too had this error in IE11 with version 0.4.0. To fix it, I pulled the node package down into my project and ran it through browserify with babelify. When comparing the differences from the node module version to my compiled version, I believe it had something to do with the nested single quotes on line 264 and line 278:

Node module version (line 264): console.warn('MicroModal v' + version + ': \u2757Seems like you have missed %c\'' + id + '\'', 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', 'ID somewhere in your code. Refer example below to resolve it.');

My compiled version: console.warn('MicroModal v' + version + ": \u2757Seems like you have missed %c'" + id + '\'', 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', 'ID somewhere in your code. Refer example below to resolve it.');

lauryneashby commented 5 years ago

I noticed today the syntax error while testing in IE11 on Micromodal version 0.4.0.

Error below:

(SCRIPT1002: Syntax error micromodal.js (1, 166))

I updated to versions 0.4.1 and 0.4.2 (No luck in fixing the script error), I have reverted to version 0.3.2 for testing and all seems to be working fine.

Any suggestions in fixing the above error would be greatly appreciated!

Thank you :)

Richifg commented 5 years ago

Had the same issue with IE. I'm working on wordpress project that uses a plugin which imports micromodal. Had to edit the plugin files to force it CDN the 0.3.2 version of micromodal.min instead of the latest.

Still, modifying a plugin is not recommend, so I'm really hoping this can be fixed on micromodal instead.

ghosh commented 5 years ago

Noted. Will triage and fix this.

YoshiMannaert commented 5 years ago

Any update on this?

davidhellmann commented 5 years ago

Same error here :/

brifiction commented 4 years ago

hi ghosh, i'm also experiencing same error for IE11 using micromodal@0.4.2.

nathansmith commented 4 years ago

We ran into this issue on a client project recently, so I was doing some local debugging. From what I can tell, the browserslist in package.json doesn't appear to be affecting the yarn build.


micromodal_ie11_support


For anyone else experiencing this issue…

We ended up reverting to version 0.3.2 and that seems to work well enough.

https://www.npmjs.com/package/micromodal/v/0.3.2

brifiction commented 4 years ago

We ran into this issue on a client project recently, so I was doing some local debugging. From what I can tell, the browserslist in package.json doesn't appear to be affecting the yarn build.

* Running `npx browserslist` at the project root shows that IE11 **should** be supported, as it's listed amongst the browsers.

* But the output of the build to the `"/lib/dist"` folder still contains `=>` in the `*.min.js` file.

micromodal_ie11_support

For anyone else experiencing this issue…

We ended up reverting to version 0.3.2 and that seems to work well enough.

https://www.npmjs.com/package/micromodal/v/0.3.2

Reverted version back to v0.3.2 and confirmed working, thanks nathansmith. I've yet to know what npx browserslist usage (will research), but v0.4.2 still doesn't initialize or load in IE11 (no browser console errors seen on IE11).

ghosh commented 4 years ago

Fixed in 0.4.3. Transpiling code with babel now. Feel free to comment on this issue in case of any problems. Closing for now.