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

Only open windows externally if window is focused #156

Merged
merged 1 commit into from
May 2, 2024

Conversation

sergeichestakov
Copy link
Contributor

Why

We've gotten some reports of the desktop app randomly opening pages when unfocused and in the background. I have a feeling this is due to some of our "openExternal" logic around redirecting non-Replit pages (or those not supported in the desktop app) to the user's browser instead. I'm not sure why this would be occurring in the background since this should usually only happen by the user clicking links or something triggering window.open but evidently it is. See Slack thread.

What changed

Only open external links in the user's browser if the window is actually focused. This will stop tabs from opening when the app is in the background.

Test plan

  • Open external links by clicking a link or calling window.open in the console when the app is focused -> should still open external links in the browser
  • Should stop getting reports of this happening when the app is unfocused though.

@sergeichestakov sergeichestakov self-assigned this May 1, 2024
@sergeichestakov sergeichestakov requested review from a team, lunaroyster, szymonkaliski and ink404 and removed request for a team May 1, 2024 16:48
Copy link
Member

@szymonkaliski szymonkaliski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good, but feels like a band-aid, is there any way in which we could know what's actually causing the windows to open randomly?

@sergeichestakov
Copy link
Contributor Author

yes definitely a band-aid 😕 Not sure yet but will keep digging

@sergeichestakov sergeichestakov merged commit d03a292 into main May 2, 2024
5 checks passed
@sergeichestakov sergeichestakov deleted the @sergeichestakov/dont-open-when-not-focused branch May 2, 2024 14:28
@sergeichestakov
Copy link
Contributor Author

corresponding web PR: https://github.com/replit/repl-it-web/pull/43941

@sergeichestakov
Copy link
Contributor Author

FYI @szymonkaliski figured it out here: https://github.com/replit/repl-it-web/pull/44658

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

Successfully merging this pull request may close these issues.

2 participants