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

App window does not respond to mouse events in window focus race condition #21743

Closed
sync-by-unito bot opened this issue May 30, 2022 · 34 comments
Closed
Labels
stage: awaiting external fix A 3rd party bug in Cypress - awaiting release type: bug v10.0.0 🐛 Issue present since 10.0.0

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented May 30, 2022

weirdness2.mov

Browsers

All browsers, EXCEPT for Electron because Electron is launched in the same docked application as Cypress

Operating Systems and Hardware

  • Reproduced on OSX Monterey w/ M1 Chip
  • Could not reproduce on OSX Catalina w/ Intel Chip
  • Reproduced intermitently on Monterey with intel Chip

Steps to reproduce

  1. Click "start component testing" with Chrome browser
  2. IMMEDIATELY move your cursor (don’t click/change focus) onto where the window will open.
  3. Again, do not click anything

Observe: hover states don’t work, pointer states aren’t working, you have to click 2-3x for any clicks to register

Workaround: Once you Cmd + Tab/lose focus to another docked application, everything will work again

This does not happen in Electron because it shares the same Docked Application with Cypress.

┆Issue is synchronized with this Jira Bug by Unito
┆Attachments: Screen Recording 2022-03-11 at 6.07.14 PM.mov | Screen Recording 2022-04-21 at 1.34.59 PM.mov
┆author: Shawn Taylor
┆epic: Edge Cases
┆friendlyId: UNIFY-1172
┆priority: Low
┆sprint: Unification Hardening
┆taskType: Bug

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bart Ledoux commented:

Could this be a chrome issue on M1 macs?

It is either this or an infinite loop.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Shawn Taylor commented:

it doesn’t seem like an infinite loop since it always resolves when i switch to another app and back

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Shawn Taylor commented:

i just tried to reproduce this and am currently unable to 🤷

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Jess Sachs commented:

I’m also getting this issue but have no idea why it’s happening.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bart Ledoux commented:

I will check on intel if it is an issue as well

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Shawn Taylor commented:

i was able to reproduce this again today, both in chrome and firefox. i’m on an M1 Mac.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bart Ledoux commented:

It behaves exactly like if chrome could not get focus

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Lachlan Miller commented:

Has anyone seen this on a non M1 machine?

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Shawn Taylor commented:

Lachlan Miller assuming that the issue Robert Guss is seeing ( https://cypressio.slack.com/archives/C02MW5QBD4K/p1644243428945549 ) is the same, then yes. he’s on a non-M1 Mac.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Lachlan Miller commented:

Shawn Taylor Gonna wait for a confirmation before going on a wild goose chase. 😅

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Lachlan Miller commented:

Looks like Robert has seen on non M1 but w/o a consistent reproduction it’s hard to really pick this up.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Tim Griesser commented:

Is this this issue primarily coming up on M1 macs? If so, based on google results for “chrome hanging m1” it seems like maybe this is more of a Chrome issue

https://www.reddit.com/r/mac/comments/qjhmp7/chrome_crashing_on_m1_pro/ ( https://www.reddit.com/r/mac/comments/qjhmp7/chrome_crashing_on_m1_pro/|smart-link )

https://www.getdroidtips.com/fix-chrome-crash-m1-m1-max/#6-Disable-Hardware-Acceleration-in-Chrome ( https://www.getdroidtips.com/fix-chrome-crash-m1-m1-max/#6-Disable-Hardware-Acceleration-in-Chrome|smart-link )

The second link above mentions disabling hardware acceleration might help. Seems we do that on linux with --disable-gpu flag:

if (os.platform() === 'linux') {
args.push('--disable-gpu')
args.push('--no-sandbox')
( https://github.com/cypress-io/cypress/blob/f79bdd665ada815fbfa238baac7a66c38d3b5d82/packages/server/lib/browsers/chrome.ts#L388-L390|smart-link ) maybe we should see if we should also be doing this on M1?

Jess Sachs / Bart Ledoux / Shawn Taylor can you reliably reproduce / see if always toggling this flag gives any improvement?

Should be able to use before:browser:launch

on('before:browser:launch', (browser = {}, launchOptions) => {
  if (browser.name === 'chrome') {
    launchOptions.args.push('--disable-gpu')
  }
})

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Lachlan Miller commented:

People encountering this: is it a chrome only issue? Maybe try firefox for a few days to fully isolate; the ticket description might need to be “App window is sometimes not interactive in chrome”?

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bart Ledoux commented:

Shawn Taylor had it on Firefox last time we tried

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Jess Sachs commented:

I’ve isolated this issue a bit more….

  1. Happens on every non-electron browser (FF, Edge, Chrome Canary, Chrome, etc)

To reproduce…

  1. open a browser
  2. IMMEDIATELY move your mouse via trackpad (don’t click/change focus) onto where the window will open.
  3. Again, do not click anything

Observe: hover states don’t work, pointer states aren’t working, you have to click 2-3x for any clicks to register

  1. Once you Cmd + Tab/lose focus to another tray application, everything will work again

You must move your mouse before the browser has fully opened to reproduce this issue.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bart Ledoux commented:

In what I see in the video below, taken on intel (Monterrey) it has to do with movement of the cursor before focus. Just moving your mouse over the window to focus and wait does not trigger the issue.

Screen Recording 2022-03-11 at 6.07.14 PM.mov

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bart Ledoux commented:

On M1 I see this issue more when I set my mouse towards the top of the app instead of towards the list.

Note: it could very well be a coincidence. The top is further from the open button than the list so it need s me to further with the cursor.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Jess Sachs commented:

I was able to reproduce this on Cypress 9 on my machine. It may be a Monterey issue.

I think we should deprioritize this issue Chris Baus and pick up something else.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Shawn Taylor commented:

this still happens to me often enough to be annoying 😕 and would probably really confuse me if i didn’t know i can just switch windows to fix it

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Tim Griesser commented:

Reopened but marked as low priority so we don’t lose track of it

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Bill Glesias commented:

I also ran into this in Firefox 99 on MacOS Monterey with intel Chip. Also appears to be intermittent and was able to open dev tools but clicking on specs and other items in the UI had no effect.

@cypress-bot cypress-bot bot added stage: review and removed stage: needs review The PR code is done & tested, needs review stage: review labels Nov 30, 2022
@lmiller1990
Copy link
Contributor

Ok - this is not Cypress specific, I reproduced in a bare-bones electron app:

bug2.mov

@lmiller1990
Copy link
Contributor

lmiller1990 commented Nov 30, 2022

Electron issue: electron/electron#36506

@lmiller1990
Copy link
Contributor

Actually... maybe nothing to do with Electron, but a MacOS bug. I reproduced with a regular Node.js program. It's more obvious with Cypress - basically, the longer you wait and the more you spam move your mouse, the worse the delay gets.

{
  "name": "electron-quick-start",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "repository": "https://github.com/electron/electron-quick-start",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "^22.0.0"
  },
  "dependencies": {
    "chrome-launcher": "^0.15.1"
  }
}
const ChromeLauncher = require("chrome-launcher");

const wait = () => new Promise(res => setTimeout(res, 2000))

async function main () {
  await wait()
  ChromeLauncher.launch({
    startingUrl: "https://google.com",
  }).then((chrome) => {
    console.log(`Chrome debugging port running on ${chrome.port}`);
  });
}

main()
bug3.mov

@lmiller1990
Copy link
Contributor

I'm moving this to blocked until we decide how we want to progress. A work-around is possible - that would be programatically change to the electron app and back to the browser after launching, but you get a flicker of the electron app, which looks a bit unpolished. The core bug is not in Cypress, but in MacOS Monterey and above, but I don't think Apple will be fixing this any time soon.

@rockindahizzy rockindahizzy added the CT Issue related to component testing label Dec 6, 2022
@nagash77 nagash77 added the prevent-stale mark an issue so it is ignored by stale[bot] label Apr 3, 2023
@lmiller1990 lmiller1990 removed their assignment Jun 28, 2023
@pherrymason
Copy link

I've stumbled into this issue while having this same problem while developing a rust application under a M2 chip on Monterrey.

Also seeing the same problem on other repositories: love2d/love#1582

Everything points this is a OS bug.

@jennifer-shehane jennifer-shehane added v10.0.0 🐛 Issue present since 10.0.0 stage: awaiting external fix A 3rd party bug in Cypress - awaiting release and removed epic:edge-cases labels Oct 4, 2023
@jennifer-shehane jennifer-shehane removed the CT Issue related to component testing label May 15, 2024
@jennifer-shehane
Copy link
Member

Closing since there's nothing actionable on our side for this.

@jennifer-shehane jennifer-shehane closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
@jennifer-shehane jennifer-shehane removed the prevent-stale mark an issue so it is ignored by stale[bot] label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: awaiting external fix A 3rd party bug in Cypress - awaiting release type: bug v10.0.0 🐛 Issue present since 10.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants