-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 iOS/Win InputTransparent layouts and add several UI tests #17286
Conversation
ced05ff
to
2561a12
Compare
/azp run MAUI-UITests |
2561a12
to
d72384a
Compare
d72384a
to
ac69639
Compare
#if ANDROID | ||
// TODO: Android is broken with everything passing through | ||
// https://github.com/dotnet/maui/issues/10252 | ||
bottom.Clicked += (s, e) => t.ViewContainer.ReportSuccessEvent(); | ||
top.Clicked += (s, e) => t.ViewContainer.ReportFailEvent(); | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if (Device == TestDevice.Android) | ||
{ | ||
// TODO: Android is broken with everything passing through so we just use that | ||
// to test the bottom button was clickable | ||
// https://github.com/dotnet/maui/issues/10252 | ||
Assert.AreEqual($"Event: {test} (SUCCESS 1)", textAfterClick); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if IOS || MACCATALYST | ||
// Containers on iOS/Mac Catalyst may be hit testable, so we need to | ||
// propagate the the view's values to its container view. | ||
if (handler.ContainerView is WrapperView wrapper) | ||
wrapper.UpdateInputTransparent(handler, view); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a change for iOS to ensure taps pass through the containers if they should.
if (!result.UserInteractionEnabled) | ||
{ | ||
// If the child also has user interaction disabled (IOW the child is InputTransparent), | ||
// then we also want to exclude it from the hit testing. | ||
|
||
return null!; | ||
} | ||
|
||
if (result is LayoutView layoutView && !layoutView.UserInteractionEnabledOverride) | ||
{ | ||
// If the child is a layout then we need to check the UserInteractionEnabledOverride | ||
// since layouts always have user interaction enabled. | ||
|
||
return null!; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we need to ensure that transparent views/layouts also allow taps to pass through.
/azp run MAUI-UITests |
No pipelines are associated with this pull request. |
static void MapInputTransparent(ILayoutHandler handler, ILayout layout) | ||
public static partial void MapBackground(ILayoutHandler handler, ILayout layout) | ||
{ | ||
if (handler.PlatformView is LayoutPanel layoutPanel && layout != null) | ||
{ | ||
layoutPanel.UpdatePlatformViewBackground(layout); | ||
} | ||
handler.PlatformView?.UpdatePlatformViewBackground(layout); | ||
} | ||
|
||
public static partial void MapInputTransparent(ILayoutHandler handler, ILayout layout) | ||
{ | ||
handler.PlatformView?.UpdatePlatformViewBackground(layout); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems Windows does IT right, but then the background just wipes it all out. Fixed this by making Background call the correct method.
/azp run MAUI-UITests |
No pipelines are associated with this pull request. |
74e3b3c
to
072f4d4
Compare
/azp run MAUI-UITests |
No pipelines are associated with this pull request. |
e9fef23
to
f5d64af
Compare
/rebase |
f5d64af
to
86befcf
Compare
Windows and iOs correctly handled transparency with regards to children, but did not allow taps to pass through
86befcf
to
e3fd0e4
Compare
/backport to release/8.0.1xx-rc2 |
Started backporting to release/8.0.1xx-rc2: https://github.com/dotnet/maui/actions/runs/6628524257 |
@PureWeen backporting to release/8.0.1xx-rc2 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Add tests and fix Windows + iOS
Using index info to reconstruct a base tree...
M src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs
M src/Core/src/Platform/iOS/LayoutView.cs
M src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
Falling back to patching base and 3-way merge...
Auto-merging src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
Auto-merging src/Core/src/Platform/iOS/LayoutView.cs
CONFLICT (content): Merge conflict in src/Core/src/Platform/iOS/LayoutView.cs
Auto-merging src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add tests and fix Windows + iOS
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@PureWeen an error occurred while backporting to release/8.0.1xx-rc2, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
Windows and iOs correctly handled transparency with regards to children, but did not allow taps to pass through # Conflicts: # src/Core/src/Platform/iOS/LayoutView.cs
Description of Change
This PR is just adding a bunch of input transparency tests so we can be suer all the combinations are working - without the need for manual tests.
This should have been part of #14846, but we did not have any UI tests at the time. This finally makes the world of InputTransparent and CascadeInputTransparent complete.
There was also a bug in the way some input transparent controls did not allow taps to pass through because the container was not transparent. And, the layout always blocked taps - even when the controls were transparent - because it was not first checking if the controls inside should block.