Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-focus-lock with [email protected] throws when focus taken from cross-origin iframe #241

Closed
chekrd opened this issue Feb 13, 2023 · 4 comments
Assignees

Comments

@chekrd
Copy link

chekrd commented Feb 13, 2023

Hi, go to https://codesandbox.io/s/focus-lock-fail-4gkvyx?file=/src/App.tsx and press Click.

In [email protected] nothing happens, but in @2.9.3 because of this, I assume, it throws and can break the app.

How can I achieve some kind of "try and swallow" approach?

@chekrd chekrd changed the title react-focus-lock throws with cross-origin iframe [email protected] throws with cross-origin iframe Feb 13, 2023
@chekrd chekrd changed the title [email protected] throws with cross-origin iframe [email protected] throws when focus taken from cross-origin iframe Feb 13, 2023
@theKashey theKashey self-assigned this Feb 13, 2023
@theKashey
Copy link
Owner

Yep, you cannot and that's a serious regression. Look like I've broken internet one another time 🎉

@nebrius
Copy link

nebrius commented Feb 14, 2023

We ran into this issue too, but pinning focus-lock to version 0.11.3 worked around the issue for us. Looking forward to the fix when you get a chance, and thanks for your work!

@chekrd
Copy link
Author

chekrd commented Feb 15, 2023

Yes, because react-focus-lock has dependency "focus-lock": "^0.doesNotMatter", all versions of react-focus-lock can be affected. The issue should be moved into the focus-lock repository.

The workaround is to install explicit versions in your package.json:
"react-focus-lock": "2.9.2", ([email protected] requires focus-lock of version ^0.11.5)
"focus-lock": "0.11.4"

@chekrd chekrd changed the title [email protected] throws when focus taken from cross-origin iframe react-focus-lock with [email protected] throws when focus taken from cross-origin iframe Feb 15, 2023
@theKashey
Copy link
Owner

An update to focus-lock(0.11.6) and react-focus-lock(2.9.4) has been released.

There is still no test securing the right behaviour as JSDOM does not support cross-origin security concerns - jsdom/jsdom#1892

I will add real Browser tests, at least a few, shortly - #242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants