diff --git a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterView.mm b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterView.mm index 6d5377350d..063e2aab81 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterView.mm +++ b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterView.mm @@ -98,6 +98,14 @@ return YES; } +/** + * Declares that the initial mouse-down when the view is not in focus will send an event to the + * view. + */ +- (BOOL)acceptsFirstMouse:(NSEvent*)event { + return YES; +} + - (BOOL)acceptsFirstResponder { return YES; } diff --git a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm index 7d29c1811b..1d78483985 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm +++ b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm @@ -72,6 +72,12 @@ TEST(FlutterViewController, HasViewThatHidesOtherViewsInAccessibility) { EXPECT_EQ(accessibilityChildren[0], viewControllerMock.flutterView); } +TEST(FlutterViewController, FlutterViewAcceptsFirstMouse) { + FlutterViewController* viewControllerMock = CreateMockViewController(); + [viewControllerMock loadView]; + EXPECT_EQ([viewControllerMock.flutterView acceptsFirstMouse:nil], YES); +} + TEST(FlutterViewController, ReparentsPluginWhenAccessibilityDisabled) { FlutterEngine* engine = CreateTestEngine(); NSString* fixtures = @(testing::GetFixturesPath());