Skip to content

[Bug]: Setting vibrancy on macOS breaks click events on WebContentsView in Electron 31 #42336

@Hans-Halverson

Description

@Hans-Halverson

Preflight Checklist

Electron Version

31.0.0-beta.7

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.4.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

29 (with BrowserViews), vibrancy is currently broken with a separate bug in 30

Expected Behavior

Click events on a WebContentsView should be detected when the BrowserWindow has vibrancy set on macOS. Depending on the version of Electron used for the attached gist, click events are either swallowed or cause the app to crash.

Actual Behavior

Click events on the WebContentsView are not registered (or potentially cause the app to crash). If I remove the vibrancy setting from the BrowserWindow then click events start working again.

In the attached gist you can see this by trying to click the red square, which should display an alert due to an onclick handler (and does display the alert when vibrancy is disabled).

Testcase Gist URL

https://gist.github.com/7f123c2282516503a73c7c0a43eb26d2

Additional Information

Like #42335, this issue also appears to trace back to this PR: #41326. The bug in the attached gist is first seen in v31.0.0-nightly.20240305, and is not seen in v31.0.0-nightly.20240304 (and the only PR in between is #41326).

However this is a bit more complicated because vibrancy still has this bug in v31.0.0-nightly.20240304 so the attached gist isn't functional, just for a different reason. I can confirm that if this potential fix for the vibrancy bug in Electron 30 is applied without #41326 then the click swallows/crashes in this issue are resolved.

When using a debug build I see that click events crash the app on this DCHECK with this stack trace

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions