-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixed [Windows] MAUI Entry in Windows always shows ClearButton despite ClearButtonVisibility set to 'Never' #25567
Conversation
Hey there @NirmalKumarYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
App.WaitForElement("EntryField"); | ||
App.Tap("EntryField"); | ||
App.EnterText("EntryField", "Entry"); | ||
VerifyScreenshot(); |
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 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 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.
@jsuarezruiz To accurately ensure ClearButtonVisibility, the entry must stay focused. Since the entry with focused state causes the keyboards to remain open in the view, resulting in failures, I changed the test case to exclude other platforms because the actual fix only relates to Windows.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
|
||
[Test] | ||
[Category(UITestCategories.Entry)] | ||
public void VerifyEntryClearButtonVisibilitySetToNever() |
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.
Actually, the test is failing on Android and iOS because the reference snapshot is pending. Could you include them?
/rebase |
0fd7182
to
d35f404
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues" | ||
x:Class="Maui.Controls.Sample.Issues.Issue25473"> | ||
|
||
<VerticalStackLayout> |
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.
LGTM but, could the test include two Entries, using the two https://learn.microsoft.com/es-es/dotnet/api/microsoft.maui.clearbuttonvisibility?view=net-maui-8.0 enum values?
Will require to validate each one with a snapshot but in this way we have a test verifying all the ClearButtonVisibility possibility.
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.
@jsuarezruiz ,Thank you for the feedback! Based on your suggestion, I have added the additional test cases to include both ClearButtonVisibility enum values. Each entry is now validated with a snapshot, ensuring we have comprehensive coverage for all ClearButtonVisibility scenarios. Please let me know if there are any further adjustments needed.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
a37c277
to
a7977ca
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
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.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
Azure Pipelines successfully started running 3 pipeline(s). |
Issue Details
Clear Button Visibility Issue in Entry Control (Windows): Even when ClearButtonVisibility is set to "Never," the Clear button appears within the Entry control on Windows. This issue is specifically observed when MinimumWidthRequest is set; without this property, the Clear button behaves as expected and remains hidden.
Root Cause
The issue stems from the layout behaviour of WinUI, where setting ClearButtonVisibility to Never and adjusting the delete button's column width to zero does not completely eliminate the button's effect on the layout. This remaining effect on the layout causes the delete button to appear occasionally or shift within the Entry control, particularly during layout adjustments.
Description of Change
This update resolves the issue by explicitly setting IsEnabled on the delete button. When ClearButtonVisibility is set to Never, the button is disabled, ensuring it remains non-interactive and hidden, regardless of layout changes. When visibility is allowed, the button is re-enabled. This approach eliminates reliance on WinUI’s opacity handling, resulting in consistent behaviour for the Entry control across different layouts.
Validated the behaviour in the following platforms
Issues Fixed
Fixes #25473
BeforeFix.mp4
AfterFix.mp4