ranbuch / accessibility

add accessibility to your website
MIT License
287 stars 35 forks source link

Can not find window #39

Closed xyz003 closed 1 year ago

xyz003 commented 1 year ago

Hello, Ran Buchnik. I used accessibility module and feeling it is very good. But I found an issue. When I use it in React it worked perfect. Nowadays, I built a project using Frontity. When run project, Accessibility is caused an issue that can't find window object. So I replaced the last code of a JS file to solve this.

node_modules/accessibility/dist/accessibility.js.

if (typeof window !== 'undefined') {
  window.Accessibility = _main["default"];
}

I hope you fix this issue.

Regards.

ranbuch commented 1 year ago

Thanks for letting me know @It-SuperDev , Could this work? self.Accessibility = _main["default"];

ranbuch commented 1 year ago

Changed window to self, please let me know if that's fixing your issue.

xyz003 commented 1 year ago

I checked with self. But I got another issue like ReferenceError: regeneratorRuntime is not defined in new version. Also I think this module works well on other fraimeworks but only donesn't work on Frontity. I don't know well about frontity but we can't get window object at first time after runing. So I suggest you fix this problem with exception handling as I already pointed out on above. There is no error in the module.

Thank you.

ranbuch commented 1 year ago

I don't understand how you are not getting self or window. Is this not running on the browser? Anyway, please check 4.5.2 and let me know.

xyz003 commented 1 year ago

Thank you for your trying. I checked the new version. But I think you changed some from ^4.4.1 version. Now I get ReferenceError: regeneratorRuntime is not defined error. As I said the module works well and my issue comes from Frontity framework. So, I would like you to change the node_modules/accessibility/dist/accessibility.js file of version ^4.4.1 to check only the window object.

Best regards.

ranbuch commented 1 year ago

Here is the current file. Please have a look on the last line of code:

image

xyz003 commented 1 year ago

Yes, I checked. But I get regeneratorRuntime is not defined from accessibility/dist/main.js

ranbuch commented 1 year ago

Perhaps it has something to do with your project? Maybe it doesn't accept ES2015 or something like that? Also, this post might be relevant. I do use async await syntax.

xyz003 commented 1 year ago

Yes, it is frontity framework issue. I hope you check your module on frontity.

ranbuch commented 1 year ago

Is there a quick way to do it? Some project that I can clone, install the module and run it? I've never developed on WordPress or React.

ranbuch commented 1 year ago

@It-SuperDev could you try to reoroduce here?

xyz003 commented 1 year ago

So it is working or not?

ranbuch commented 1 year ago

I have no idea, was hoping you could reproduce and send me a link.

xyz003 commented 1 year ago
if (typeof window !== 'undefined') {
  window.Accessibility = _main["default"];
}

This is the idea. Please make version same as 4.4.1 and add above code. Then it will work perfectly.

ranbuch commented 1 year ago

Is that okay?

xyz003 commented 1 year ago

difficult to solve