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

RFC: Update refocusExchange to utilize Page Visibility API #1063

Closed
kitten opened this issue Oct 14, 2020 · 3 comments · Fixed by #1077
Closed

RFC: Update refocusExchange to utilize Page Visibility API #1063

kitten opened this issue Oct 14, 2020 · 3 comments · Fixed by #1077
Assignees
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release

Comments

@kitten
Copy link
Member

kitten commented Oct 14, 2020

See: #1055

Summary

There are known issues that occur with the focus event:

  • iframe can cause the focus event to fire numerous times if the user interacts with the iframe and then back with the current document
  • DevTools can cause the focus event to fire numerous times if the user/developer interacts with the DevTools and then back with the document. (A very common case for developers)
  • A developer fires a focus event (ie. node.dispatchEvent(new CustomEvent('focus', { bubbles: true}))). This case seems less likely but still a side-effect of the current implementation.

We may also want to check what other libraries, like swr, are doing.

Proposed Solution

  • Check whether the Page Visiblity API can help with this
  • Reimplement refocusExchange with the new API
  • Preserve IE11 support with fallbacks, polyfills, or workarounds (or an alternative approach entirely?)
@kitten kitten added the future 🔮 An enhancement or feature proposal that will be addressed after the next release label Oct 14, 2020
@JoviDeCroock
Copy link
Collaborator

JoviDeCroock commented Oct 16, 2020

I have just verified the Page visbility API on IE11 (Windows 10) and it works correctly as mentioned on MDN.

In SWR they are using the same API for revalidation.

@tatchi
Copy link
Contributor

tatchi commented Oct 18, 2020

Hi,

Has anyone started to work on this? If not, I would love to give it a shot :)

@JoviDeCroock
Copy link
Collaborator

Hey @tatchi,

Noone has picked this up as far as I'm aware, feel free to give it a shot. In case you're not sure or want some guidance you can put it up as draft and I'd be glad ot help out where I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants