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

Returning focus to element inside an iframe #296

Closed
spatel49 opened this issue Mar 26, 2024 · 2 comments
Closed

Returning focus to element inside an iframe #296

spatel49 opened this issue Mar 26, 2024 · 2 comments
Labels

Comments

@spatel49
Copy link

Hey there!

I hope you're doing well. I just wanted to inform you of an issue we're facing with unexpected focus behavior when upgrading our react-focus-lock package from 2.11.2 to 2.9.3.

The problem we’re seeing is that the iframe document unexpectedly scrolls to the top of the page after closing certain modals, because it tries to return focus to the iframe element, and then focuses the header element (the first focusable node in the document). Ideally, it should look through the iframe when it’s determining what the active element is when the focus lock is first set up.

@theKashey
Copy link
Owner

🤔 Correct, the current return focus logic is not "entering" iframes and/or shadow dom, so cannot properly return element where it belongs. That should not be affected by the version change as return focus always was operating within a single document.

Anyway, tell me how exactly one can reproduce the problem?

  • there is a host page with focus-lock
  • it renders an iframe
  • the focus is within given iframe
  • who opens the modal?

Copy link

stale bot commented May 26, 2024

This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.

@stale stale bot added the state label May 26, 2024
@stale stale bot closed this as completed Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants