theKashey / react-focus-on

🎯 Solution for WAI ARIA compatible modal dialogs or full-screen tasks, you were looking for
MIT License
333 stars 14 forks source link

Add explicit `crossFrame` support for `ReactFocusLock` #73

Closed cee-chen closed 1 year ago

cee-chen commented 1 year ago

closes https://github.com/theKashey/react-focus-on/issues/72

As of 2.3.0, react-focus-lock has supported a crossFrame prop which allows focus to escape to outside iframes when false.

react-focus-on currently does not expose passing that prop directly to react-focus-lock, but we'd really appreciate that support being added 🙏

Please let me know if I'm missing any docs or tests in this PR!

cee-chen commented 1 year ago

@theKashey I opened this PR to hopefully save you a bit of time - please let me know if you see any issues, or if you have objections to support being added!

theKashey commented 1 year ago

Hey @cee-chen - thank you for stepping in and, well, making the change happen. Even if this is just a few lines my time is quite limited nowadays.

Change is approved, but can you help me create a better explanation for this prop. It's not about behavior of iframes, but behavior if "you" are inside iframe.

Something like

 enables or disables cross-frame focus management when using FocusLock within an iframe. `true` means that focus will be restricted within the iframe, while `false` allows focus to leave the iframe and move to elements outside of it. Default `true`

(generated by ChatGPT 🤷‍♂️)

cee-chen commented 1 year ago

No problem at all, super happy to help! Let me tweak the docs copy here a bit based on your prompt!

cee-chen commented 1 year ago

@theKashey let me know if that resolves your docs request or if you think the README addition needs tweaking as well!

theKashey commented 1 year ago

👍