theKashey / focus-lock

Gotcha! A11y util for scoping a focus.
MIT License
172 stars 17 forks source link

ES5 compatibility #3

Closed mjss closed 6 years ago

mjss commented 6 years ago

What problem does this feature solve?

When using this module, it requires some polyfills (like Array.from and Array.find) to work on old browsers like IE. As a low level module, I think it will be nice to provide compatibility to ES5 out of the box, so that the user doesn't need to worry about polyfills.

theKashey commented 6 years ago

It sounds like https://github.com/theKashey/vue-focus-lock/issues/3

Probably adding polyfill is the best way to mitigate this, as long those 2 commands are very popular (it's a babel helper _toConsumableArray), and sooner or later you will include some library with the same requirements.

I will try to do something, just when get some free time. But I have to idea when.

mjss commented 6 years ago

@theKashey Thank you for your reply! I agree this is a common problem. We are using this module in a vue component library. I don't want to import a polyfill module like babel-polyfill because it will increase the bundle size. And yes now I am adding individual polyfill for Array.from and Array.find (plus fix focus-lock version in package.json) to mitigate this issue. But it will be best if this module can natively support ES5.

theKashey commented 6 years ago

I'll take a look. PS: You shall not include any polyfills if you are a library.