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

fix: webContents interaction with draggable BrowserViews #26496

Merged
merged 1 commit into from Nov 17, 2020

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Nov 14, 2020

Description of Change

Closes #26355.

Fixed an issue where some buttons were un-clickable in some BrowserViews with draggable regions enabled.

This was happening because the way we construct draggable regions in BrowserViews is different than what we do in BrowserWindows - we implement them in the former by creating a new draggable NSView and overlaying regions that are not draggable. To accomplish this, we need to hitTest the view, so we can perform the correct actions when a user mouses down and tries to drag. Chromium explicitly chooses to ignore mouse events in RenderWidgetHostViewCocoa when another view has returned itself in the hitTest, which is the case here and the root of the bug.

To fix the issue resultant of the above, we explicitly need to tell Chromium that it should not use its own mouse ignore logic if a NSEventTypeLeftMouseDragged or NSEventTypeLeftMouseDown event - it should first check to see if we've told it not to do that and then proceed accordingly.

Tested with https://gist.github.com/060ad478da5b628726da4b4ea94a16a6.

cc @MarshallOfSound @zcbenz

Checklist

Release Notes

Notes: Fixed an issue where some buttons were un-clickable in some BrowserViews with draggable regions enabled.

@codebytere codebytere requested a review from a team as a code owner November 14, 2020 04:33
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Nov 14, 2020
@codebytere codebytere changed the title fix: webContents interaction with draggable browserviews fix: webContents interaction with draggable BrowserViews Nov 14, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Nov 15, 2020
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

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

Did some testing and could not find any problem with this approach.

@codebytere codebytere merged commit d97612e into master Nov 17, 2020
@release-clerk
Copy link

release-clerk bot commented Nov 17, 2020

Release Notes Persisted

Fixed an issue where some buttons were un-clickable in some BrowserViews with draggable regions enabled.

@codebytere codebytere deleted the mouse-draggable branch November 17, 2020 04:41
@trop
Copy link
Contributor

trop bot commented Nov 17, 2020

I was unable to backport this PR to "10-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Nov 17, 2020

I was unable to backport this PR to "9-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Nov 17, 2020

I have automatically backported this PR to "11-x-y", please check out #26528

@trop
Copy link
Contributor

trop bot commented Dec 1, 2020

@codebytere has manually backported this PR to "9-x-y", please check out #26745

@trop
Copy link
Contributor

trop bot commented Dec 1, 2020

@codebytere has manually backported this PR to "10-x-y", please check out #26744

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.

Cannot click a button in a BrowserView -- MouseEvents are captured by drag?
3 participants