[Mac]Clear button not hidden when text is cleared - #34737
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34737Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34737" |
There was a problem hiding this comment.
Pull request overview
Fixes a MacCatalyst-specific UISearchBar behavior where the built-in clear (X) button remains visible after the SearchBar text is cleared, by adding a MacCatalyst-only visibility update and introducing an Issue page + UITest coverage for #34422.
Changes:
- Add MacCatalyst-only helpers to locate the native clear button and toggle its visibility based on whether text is present.
- Invoke the clear-button visibility update from the iOS/MacCatalyst SearchBar handler during relevant update paths.
- Add a new HostApp issue page and corresponding Shared UITest for Issue #34422.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Core/src/Platform/iOS/SearchBarExtensions.cs | Adds MacCatalyst-only clear button lookup (KVC) and visibility update helper. |
| src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs | Caches a clear-button reference and calls the new visibility updater during handler updates/editing. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34422.cs | Adds a new UITest intended to validate clear button visibility before/after clearing text. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue34422.cs | Adds the HostApp issue page used by the UITest scenario. |
kubaflo
left a comment
There was a problem hiding this comment.
Could you please review the AI's summary?
@kubaflo , I've addressed the AI summary |
kubaflo
left a comment
There was a problem hiding this comment.
Could you please resolve conflicts
749cf01 to
e20c2f1
Compare
@kubaflo , I have resolved the conflicts |
kubaflo
left a comment
There was a problem hiding this comment.
Could you please add a snapshot?
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@devanathan-vaithiyanathan — new AI review results are available based on this last commit:
a4adaad. To request a fresh review after new comments or commits, comment/review rerun.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ❌ FAILED
Platform: CATALYST · Base: main · Merge base: fced7612
🩺 Fix does not pass the tests — every test still fails after applying the fix. The PR's change does not resolve the failure(s).
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🖥️ Issue34422 Issue34422 |
✅ FAIL — 166s | ❌ FAIL — 122s |
🔴 Without fix — 🖥️ Issue34422: FAIL ✅ · 166s
(truncated to last 15,000 chars)
9
Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Maps.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-maccatalyst26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.Xaml.dll
Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.Maps.dll
Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.Foldable.dll
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-maccatalyst/maccatalyst-x64/Controls.TestCases.HostApp.dll
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Optimizing assemblies for size. This process might take a while.
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-maccatalyst/maccatalyst-arm64/Controls.TestCases.HostApp.dll
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Optimizing assemblies for size. This process might take a while.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:01:41.37
Determining projects to restore...
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/CustomAttributes/Controls.CustomAttributes.csproj (in 1.1 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Core/UITest.Core.csproj (in 1.1 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj (in 1.02 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.NUnit/UITest.NUnit.csproj (in 1.87 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Appium/UITest.Appium.csproj (in 2.87 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj (in 4.58 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj (in 6.97 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj (in 7.01 sec).
5 of 13 projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
Controls.TestCases.Mac.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0/Controls.TestCases.Mac.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0/Controls.TestCases.Mac.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.08] Discovering: Controls.TestCases.Mac.Tests
[xUnit.net 00:00:00.20] Discovered: Controls.TestCases.Mac.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0/Controls.TestCases.Mac.Tests.dll
NUnit3TestExecutor discovered 2 of 2 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 6/29/2026 9:33:43 AM The SaveDeviceDiagnosticInfo threw an exception during Issue34422(Mac).
Exception details: System.InvalidOperationException: Call InitialSetup before accessing the App property.
at UITest.Appium.NUnit.UITestContextBase.get_App() in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 32
at UITest.Appium.NUnit.UITestBase.SaveDeviceDiagnosticInfo(String note, Boolean storeForReattachment) in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 255
TearDown failed for test fixture Microsoft.Maui.TestCases.Tests.Issues.Issue34422(Mac)
OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
TearDown : System.InvalidOperationException : Call InitialSetup before accessing the App property.
StackTrace: at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
at UITest.Appium.AppiumServerContext.CreateUIClientContext(IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumServerContext.cs:line 40
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context, Boolean reset) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 77
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 55
at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 215
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--TearDown
at UITest.Appium.NUnit.UITestContextBase.get_App() in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 32
at UITest.Appium.NUnit.UITestBase.OneTimeTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 244
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
NUnit Adapter 4.5.0.0: Test execution complete
Failed SearchBarClearButtonShouldBeVisibleWithText [14 s]
Error Message:
OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
Stack Trace:
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
at UITest.Appium.AppiumServerContext.CreateUIClientContext(IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumServerContext.cs:line 40
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context, Boolean reset) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 77
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 55
at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 215
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Failed SearchBarClearButtonShouldDisappearAfterClearingInput [14 s]
Error Message:
OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
Stack Trace:
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
at UITest.Appium.AppiumServerContext.CreateUIClientContext(IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumServerContext.cs:line 40
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context, Boolean reset) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 77
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 55
at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 215
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue34422.trx
Total tests: 2
Failed: 2
Test Run Failed.
Total time: 19.3431 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue34422.trx
🟢 With fix — 🖥️ Issue34422: FAIL ❌ · 122s
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Maps.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-maccatalyst26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.Maps.dll
Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.Foldable.dll
Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-maccatalyst26.0/Microsoft.Maui.Controls.Xaml.dll
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-maccatalyst/maccatalyst-x64/Controls.TestCases.HostApp.dll
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Optimizing assemblies for size. This process might take a while.
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-maccatalyst/maccatalyst-arm64/Controls.TestCases.HostApp.dll
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Optimizing assemblies for size. This process might take a while.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:01:24.22
Determining projects to restore...
All projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.90-ci+azdo.14516699
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
Controls.TestCases.Mac.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0/Controls.TestCases.Mac.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0/Controls.TestCases.Mac.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.08] Discovering: Controls.TestCases.Mac.Tests
[xUnit.net 00:00:00.20] Discovered: Controls.TestCases.Mac.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0/Controls.TestCases.Mac.Tests.dll
NUnit3TestExecutor discovered 2 of 2 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 6/29/2026 9:35:46 AM The SaveDeviceDiagnosticInfo threw an exception during Issue34422(Mac).
Exception details: System.InvalidOperationException: Call InitialSetup before accessing the App property.
at UITest.Appium.NUnit.UITestContextBase.get_App() in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 32
at UITest.Appium.NUnit.UITestBase.SaveDeviceDiagnosticInfo(String note, Boolean storeForReattachment) in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 255
TearDown failed for test fixture Microsoft.Maui.TestCases.Tests.Issues.Issue34422(Mac)
OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
TearDown : System.InvalidOperationException : Call InitialSetup before accessing the App property.
StackTrace: at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
at UITest.Appium.AppiumServerContext.CreateUIClientContext(IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumServerContext.cs:line 40
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context, Boolean reset) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 77
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 55
at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 215
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--TearDown
at UITest.Appium.NUnit.UITestContextBase.get_App() in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 32
at UITest.Appium.NUnit.UITestBase.OneTimeTearDown() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 244
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
NUnit Adapter 4.5.0.0: Test execution complete
Failed SearchBarClearButtonShouldBeVisibleWithText [6 s]
Error Message:
OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
Stack Trace:
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
at UITest.Appium.AppiumServerContext.CreateUIClientContext(IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumServerContext.cs:line 40
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context, Boolean reset) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 77
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 55
at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 215
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Failed SearchBarClearButtonShouldDisappearAfterClearingInput [6 s]
Error Message:
OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
Stack Trace:
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
at UITest.Appium.AppiumServerContext.CreateUIClientContext(IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumServerContext.cs:line 40
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context, Boolean reset) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 77
at UITest.Appium.NUnit.UITestContextBase.InitialSetup(IServerContext context) in /_/src/TestUtils/src/UITest.NUnit/UITestContextBase.cs:line 55
at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 215
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue34422.trx
Test Run Failed.
Total tests: 2
Failed: 2
Total time: 11.5506 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue34422.trx
⚠️ Failure Details
- ❌ Issue34422 FAILED with fix (should pass)
SearchBarClearButtonShouldBeVisibleWithText [6 s]; SearchBarClearButtonShouldDisappearAfterClearingInput [6 s]OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be f...; OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred whi...
📁 Fix files reverted (2 files)
src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cssrc/Core/src/Platform/iOS/SearchBarExtensions.cs
📱 UI Tests — SearchBar,ViewBaseTests
Detected UI test categories: SearchBar,ViewBaseTests
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
SearchBar |
0/36 (setup failed; 36 marked failed) | — |
ViewBaseTests |
0/112 (setup failed; 112 marked failed) | — |
⚠️ SearchBar — fixture setup failed for 36 tests
NUnit reported a OneTimeSetUp/fixture setup failure before test bodies ran; the TRX marked each affected test failed.
OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
...
⚠️ ViewBaseTests — fixture setup failed for 112 tests
NUnit reported a OneTimeSetUp/fixture setup failure before test bodies ran; the TRX marked each affected test failed.
OneTimeSetUp: OpenQA.Selenium.UnknownErrorException : An unknown server-side error occurred while processing the command. Original error: The app representing com.microsoft.maui.uitests could not be found.
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout, AppiumClientConfig clientConfig)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Mac.MacDriver..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
at UITest.Appium.AppiumCatalystApp..ctor(Uri remoteAddress, IConfig config) in /_/src/TestUtils/src/UITest.Appium/AppiumCatalystApp.cs:line 11
...
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)
📋 Pre-Flight — Context & Validation
Issue: #34422 - [MAUI] N ScrollView_N4-Search Bar: If clear the input, x button still appears on MacCatalyst
PR: #34737 - [Mac]Clear button not hidden when text is cleared
Platforms Affected: MacCatalyst / macOS
Files Changed: 2 implementation, 10 test/snapshot
Key Findings
- PR fix toggles the internal SearchBar clear button
Hiddenstate through KVC on MacCatalyst. - Gate result supplied to this run failed; tests did not behave as expected and gate must not be rerun.
- Local
ghaccess was unavailable, so PR metadata was gathered from public GitHub API plus the local review branch.
Code Review Summary
Verdict: NEEDS_CHANGES
Confidence: low
Errors: 1 | Warnings: 2 | Suggestions: 0
Key code review findings:
- ✗ Gate failed for the exact Issue34422 MacCatalyst SearchBar clear-button scenario.
- ⚠
GetClearButton()allocatesnew NSString("clearButton")on each call. - ⚠ Clear-button visibility is coupled to
MapCancelButtonColor, which is not the semantic owner for text-presence updates.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #34737 | KVC lookup of internal clear button and synchronous Hidden toggle from handler callbacks |
❌ FAILED (Gate) | SearchBarHandler.iOS.cs, SearchBarExtensions.cs, UI tests/snapshots |
Original PR |
🔬 Code Review — Deep Analysis
Code Review — PR #34737
Independent Assessment
What this changes: Adds a MacCatalyst-only UpdateClearButtonVisibility helper for UISearchBar, accessed through the internal clear button KVC key, and calls it from SearchBar handler text/cancel-button paths. Adds Issue34422 UI tests and snapshots for SearchBar clear-button behavior.
Inferred motivation: On MacCatalyst, clearing SearchBar text can leave the internal X clear affordance visible even when no text remains.
Reconciliation with PR Narrative
Author claims: MacCatalyst-specific fix that accesses the clear button via the clearButton key and sets Hidden based on text presence.
Agreement/disagreement: The code matches the stated approach, but automated gate evidence supplied to this run says tests did not behave as expected, so the implementation is not proven.
Prior Review Reconciliation
| Prior ❌ Error Finding | Source | Status | Evidence |
|---|---|---|---|
| Gate still fails Issue34422; clear affordance remains visible after clearing | Gate result / prior automated review context | ❌ Unresolved | User-provided gate result says Gate FAILED and must not be rerun. |
Blast Radius Assessment
- Runs for all instances: MacCatalyst SearchBar instances only, due to
OperatingSystem.IsMacCatalyst()guard. - Startup impact: No static startup path; invoked from handler mapper/callbacks.
- Static/shared state: No shared state in the PR fix.
CI Status
- Required-check result: not queried with
ghbecause GitHub CLI authentication is unavailable in this environment. - Classification: undetermined; user-provided gate result is failed.
- Action taken: confidence capped at low.
Findings
❌ Error — Gate failed for the exact regression scenario
The supplied gate result says tests did not behave as expected. Because the new UI tests target Issue34422 and the platform is MacCatalyst, the PR fix cannot be treated as validated.
⚠️ Warning — Per-call NSString allocation for KVC key
src/Core/src/Platform/iOS/SearchBarExtensions.cs creates new NSString("clearButton") for each GetClearButton() call. This is minor but avoidable with a cached static key.
⚠️ Warning — Visibility logic is piggybacked on CancelButtonColor
src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs invokes clear-button visibility from MapCancelButtonColor, which is semantically about the external cancel affordance, not the internal text clear affordance.
Failure-Mode Probing
- UIKit layout re-shows the internal clear button after MAUI sets
Hidden: plausible and consistent with the failed gate; candidate 2/3 explored timing/lifecycle alternatives. - Clear button unavailable before window attach: PR null-checks the KVC result, so this is safe but may no-op until a later callback.
- Handler disconnect/reconnect: no new subscriptions are added by the PR fix.
Verdict: NEEDS_CHANGES
Confidence: low
Summary: The PR’s approach is plausible but not validated; the supplied gate failed for the exact scenario. Alternative candidates were explored, but local UI execution was blocked by MacCatalyst Appium launch setup.
🛠️ Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | Use public UITextField.ClearButtonMode instead of private clear-button Hidden mutation |
1 file | Build succeeded; UI test setup failed before behavior (com.microsoft.maui.uitests not found). |
|
| 2 | try-fix | Move ownership to MapText and defer Hidden write with main-queue dispatch |
2 files | Build succeeded; same UI test setup failure before behavior. | |
| 3 | try-fix | Persist desired state in MauiSearchBar and reapply after LayoutSubviews |
5 files | First compile iteration fixed; second iteration built, then same UI test setup failure. | |
| PR | PR #34737 | KVC lookup of internal clear button and synchronous Hidden toggle from handler callbacks |
❌ FAILED (Gate) | 12 files | Original PR; gate failed per supplied result. |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| maui-expert-reviewer | 1 | Yes | Candidate 1: drive UITextField.ClearButtonMode instead of private button Hidden. |
| maui-expert-reviewer | 2 | Yes | Candidate 2: use MapText ownership and defer the KVC Hidden write after UIKit layout. |
| maui-expert-reviewer | 3 | Yes | Candidate 3: move state ownership into MauiSearchBar.LayoutSubviews to reapply after every layout pass. |
| maui-expert-reviewer | 4 | No | Meaningfully different approaches exhausted: public text-field policy, handler timing/mapper ownership, and platform-view lifecycle were all explored. |
Exhausted: Yes
Selected Fix: None — no candidate passed all tests. Candidate 3 is the strongest theoretical alternative because it directly addresses UIKit relayout undoing Hidden, but it was not behaviorally validated due to the local MacCatalyst Appium launch blocker.
📝 Recommended PR Title & Description
Assessment: ✏️ Recommend updating — the current title is missing the component delimiter, and the current description documents the raw PR's Hidden toggle rather than the winning try-fix-2 approach.
Recommended title
[Mac] SearchBar: Hide clear button when text is cleared
Recommended description
### Issue Details
On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text.
### Description of Change
* Updates MacCatalyst SearchBar clear-button visibility from text-owned paths instead of piggybacking on `CancelButtonColor` mapping.
* Calls `UpdateClearButtonVisibility()` from `MapText` and after the SearchBar moves to a window so programmatic text changes and initial/native lifecycle updates can refresh the native clear affordance.
* Defers the private clear-button `Hidden` write to the main queue so UIKit/Catalyst layout has a chance to settle before the final visibility update.
### Issues Fixed
Fixes #34422
**Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac
| Before | After |
|---------|--------|
| **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> |
🏁 Report — Final Recommendation
Comparative Candidate Report — PR #34737
Inputs considered
pr: raw PR #34737 fix as submitted on local branchpr-review-34737.pr-plus-reviewer: raw PR plus the expert reviewer cache-key feedback applied in a sandbox worktree.try-fix-1: publicUITextField.ClearButtonModeapproach.try-fix-2: text-mapper-owned deferred clear-button visibility approach.try-fix-3:MauiSearchBar.LayoutSubviewslifecycle reapplication approach.
The supplied gate result for the PR failed and was not rerun. The saved try-fix artifacts show all try-fix candidates built far enough for review but were blocked from behavioral validation by the MacCatalyst Appium launch error (com.microsoft.maui.uitests not found). Public prior review context also contains earlier error-level findings against the raw PR approach.
Ranking
| Rank | Candidate | Regression result | Assessment |
|---|---|---|---|
| 1 | try-fix-2 |
Blocked / not behaviorally proven in saved STEP 5a artifacts | Best design tradeoff: moves clear-button visibility ownership to MapText and OnMovedToWindow, removes the unrelated MapCancelButtonColor coupling, and defers the private button write one main-queue turn so UIKit layout has a chance to settle. It still relies on private KVC/Hidden, but it directly addresses the strongest lifecycle/mapper criticism without public API churn. |
| 2 | pr-plus-reviewer |
PR gate failed | Strictly better than pr because it caches the KVC key and removes per-edit native allocation, but it leaves the major correctness concerns unchanged: wrong mapper ownership and synchronous Hidden write. |
| 3 | try-fix-1 |
Blocked / not behaviorally proven in saved STEP 5a artifacts | Cleanest API surface because it uses public UITextField.ClearButtonMode and removes private clear-button KVC. However, it does not address mapper ownership and is less targeted if Catalyst ignores the text-field mode for this rendered affordance. |
| 4 | try-fix-3 |
Blocked / not behaviorally proven in saved STEP 5a artifacts | Strong lifecycle idea because it persists and reapplies state after layout, but it introduces a public LayoutSubviews override/PublicAPI churn and per-layout private lookup for a localized bug. |
| 5 | pr |
PR gate failed | Raw PR targets the right issue but keeps the unresolved issues: MapCancelButtonColor coupling, synchronous private Hidden mutation, and per-call NSString allocation. |
Winner
Winner: try-fix-2
try-fix-2 is the best available candidate because no candidate has passing regression evidence, and it fixes the most important structural flaw in the PR: clear-button state should be synchronized from text state/lifecycle, not from cancel-button-color mapping. It is still unproven due to the test-environment blocker, but it is more likely to address the root lifecycle issue than pr/pr-plus-reviewer and avoids the public API churn of try-fix-3.
Notes for follow-up
The winning candidate should still be validated on a functioning MacCatalyst UI-test environment. If validation shows the deferred Hidden write remains insufficient, the next iteration should preserve try-fix-2's mapper ownership but replace the private-button mutation with the empirically proven native invalidation mechanism.
🧭 Next Steps — alternative fix proposed (try-fix-2)
Automated review — alternative fix proposed
The expert-reviewer evaluation compared the PR fix against automatically generated candidates and selected try-fix-2 as the strongest fix.
Why: try-fix-2 wins because no candidate has passing regression evidence, and it best addresses the PR's core lifecycle flaw by moving clear-button visibility synchronization to text-owned paths and deferring the native update. It avoids the raw PR's cancel-button mapper coupling and avoids try-fix-3's public API churn.
Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.
Candidate diff (try-fix-2)
diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarClearButtonShouldBeVisibleWithText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarClearButtonShouldBeVisibleWithText.png
new file mode 100644
index 0000000000..b6ef2e77f9
Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarClearButtonShouldBeVisibleWithText.png differ
diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarClearButtonShouldDisappearAfterClearingInput.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarClearButtonShouldDisappearAfterClearingInput.png
new file mode 100644
index 0000000000..6e9c3287db
Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarClearButtonShouldDisappearAfterClearingInput.png differ
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue34422.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue34422.cs
new file mode 100644
index 0000000000..63fb9e2df7
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue34422.cs
@@ -0,0 +1,50 @@
+namespace Maui.Controls.Sample.Issues;
+
+[Issue(IssueTracker.Github, 34422, "SearchBar clear button still appears on MacCatalyst after clearing input", PlatformAffected.macOS)]
+public class Issue34422 : ContentPage
+{
+ readonly SearchBar _searchBar;
+
+ public Issue34422()
+ {
+ _searchBar = new SearchBar
+ {
+ Placeholder = "Search...",
+ AutomationId = "TestSearchBar"
+ };
+
+ var addTextButton = new Button
+ {
+ Text = "Add Text",
+ AutomationId = "AddTextButton"
+ };
+
+ addTextButton.Clicked += (s, e) =>
+ {
+ _searchBar.Text = "Search text";
+ };
+
+ var clearButton = new Button
+ {
+ Text = "Clear SearchBar Text",
+ AutomationId = "ClearButton"
+ };
+
+ clearButton.Clicked += (s, e) =>
+ {
+ _searchBar.Text = string.Empty;
+ };
+
+ Content = new VerticalStackLayout
+ {
+ Padding = new Thickness(20),
+ Spacing = 10,
+ Children =
+ {
+ _searchBar,
+ addTextButton,
+ clearButton
+ }
+ };
+ }
+}
diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SearchBarClearButtonShouldBeVisibleWithText.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SearchBarClearButtonShouldBeVisibleWithText.png
new file mode 100644
index 0000000000..53e2df9041
Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SearchBarClearButtonShouldBeVisibleWithText.png differ
diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SearchBarClearButtonShouldDisappearAfterClearingInput.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SearchBarClearButtonShouldDisappearAfterClearingInput.png
new file mode 100644
index 0000000000..941c517810
Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SearchBarClearButtonShouldDisappearAfterClearingInput.png differ
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34422.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34422.cs
new file mode 100644
index 0000000000..7c57fa8ddc
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34422.cs
@@ -0,0 +1,34 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues;
+
+public class Issue34422 : _IssuesUITest
+{
+ public Issue34422(TestDevice device) : base(device) { }
+
+ public override string Issue => "SearchBar clear button still appears on MacCatalyst after clearing input";
+
+ [Test, Order(1)]
+ [Category(UITestCategories.SearchBar)]
+ public void SearchBarClearButtonShouldBeVisibleWithText()
+ {
+ App.WaitForElement("TestSearchBar");
+ App.Tap("TestSearchBar");
+ App.Tap("AddTextButton");
+ VerifyScreenshot();
+ }
+
+ [Test, Order(2)]
+ [Category(UITestCategories.SearchBar)]
+ public void SearchBarClearButtonShouldDisappearAfterClearingInput()
+ {
+ // First add text so the clear button appears
+ App.WaitForElement("TestSearchBar");
+ App.Tap("TestSearchBar");
+ App.Tap("AddTextButton");
+ App.Tap("ClearButton");
+ VerifyScreenshot();
+ }
+}
diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarClearButtonShouldBeVisibleWithText.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarClearButtonShouldBeVisibleWithText.png
new file mode 100644
index 0000000000..a48ab83535
Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarClearButtonShouldBeVisibleWithText.png differ
diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarClearButtonShouldDisappearAfterClearingInput.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarClearButtonShouldDisappearAfterClearingInput.png
new file mode 100644
index 0000000000..1c355cdc7e
Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarClearButtonShouldDisappearAfterClearingInput.png differ
diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchBarClearButtonShouldBeVisibleWithText.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchBarClearButtonShouldBeVisibleWithText.png
new file mode 100644
index 0000000000..eed0bcedad
Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchBarClearButtonShouldBeVisibleWithText.png differ
diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchBarClearButtonShouldDisappearAfterClearingInput.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchBarClearButtonShouldDisappearAfterClearingInput.png
new file mode 100644
index 0000000000..c29da0e343
Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchBarClearButtonShouldDisappearAfterClearingInput.png differ
diff --git a/src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs b/src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs
index 1dc40563ca..bd02f72840 100644
--- a/src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs
+++ b/src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs
@@ -18,7 +18,6 @@ namespace Microsoft.Maui.Handlers
_editor = searchBar.GetSearchTextField();
-
return searchBar;
}
@@ -157,6 +156,9 @@ namespace Microsoft.Maui.Handlers
public static void MapCancelButtonColor(ISearchBarHandler handler, ISearchBar searchBar)
{
handler.PlatformView?.UpdateCancelButton(searchBar);
+ if (handler is SearchBarHandler searchBarHandler)
+ handler.PlatformView?.UpdateClearButtonVisibility(!string.IsNullOrEmpty(searchBar.Text));
+
}
internal static void MapSearchIconColor(ISearchBarHandler handler, ISearchBar searchBar)
@@ -280,6 +282,7 @@ namespace Microsoft.Maui.Handlers
if (Handler is SearchBarHandler handler)
{
handler.UpdateCancelButtonVisibility();
+ handler.PlatformView?.UpdateClearButtonVisibility(!string.IsNullOrEmpty(VirtualView?.Text));
}
}
diff --git a/src/Core/src/Platform/iOS/SearchBarExtensions.cs b/src/Core/src/Platform/iOS/SearchBarExtensions.cs
index a8b498e4ed..3af31e1cf0 100644
--- a/src/Core/src/Platform/iOS/SearchBarExtensions.cs
+++ b/src/Core/src/Platform/iOS/SearchBarExtensions.cs
@@ -99,6 +99,24 @@ namespace Microsoft.Maui.Platform
textField.UpdateFont(textStyle, fontManager);
}
+ internal static void UpdateClearButtonVisibility(this UISearchBar uiSearchBar, bool hasText)
+ {
+ if (OperatingSystem.IsMacCatalyst())
+ {
+ var clearButton = uiSearchBar.GetClearButton();
+
+ if (clearButton != null)
+ {
+ var shouldHide = !hasText;
+
+ if (clearButton.Hidden != shouldHide)
+ {
+ clearButton.Hidden = shouldHide;
+ }
+ }
+ }
+ }
+
public static void UpdateVerticalTextAlignment(this UISearchBar uiSearchBar, ISearchBar searchBar)
{
uiSearchBar.UpdateVerticalTextAlignment(searchBar, null);
@@ -460,5 +478,7 @@ namespace Microsoft.Maui.Platform
var end = textField.GetPosition(start, endOffset - startOffset);
return end ?? start;
}
+ internal static UIButton? GetClearButton(this UISearchBar searchBar) =>
+ searchBar.GetSearchTextField()?.ValueForKey(new NSString("clearButton")) as UIButton;
}
}
\ No newline at end of file
kubaflo
left a comment
There was a problem hiding this comment.
Looks like the test is still failing
@kubaflo , |
| public static void MapCancelButtonColor(ISearchBarHandler handler, ISearchBar searchBar) | ||
| { | ||
| handler.PlatformView?.UpdateCancelButton(searchBar); | ||
| if (handler is SearchBarHandler searchBarHandler) | ||
| handler.PlatformView?.UpdateClearButtonVisibility(!string.IsNullOrEmpty(searchBar.Text)); | ||
|
|
||
| } |
| public void SearchBarClearButtonShouldBeVisibleWithText() | ||
| { | ||
| App.WaitForElement("TestSearchBar"); | ||
| App.Tap("TestSearchBar"); | ||
| App.Tap("AddTextButton"); | ||
| VerifyScreenshot(); | ||
| } |
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text. ### Description of Change <!-- Enter description of the fix in this section --> * Added UpdateClearButtonVisibility() method for MacCatalyst * Accesses the cancel button via "clear button" key * Sets cancelButton.Hidden = !hasText to control visibility ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #34422 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [ ] Android - [ ] Windows - [ ] iOS - [x] Mac | Before | After | |---------|--------| | **Mac**<br> <video src="https://github.com/user-attachments/assets/a1e0de55-9064-4c22-b529-3d6603dce289" width="600" height="300"> | **Mac**<br> <video src="https://github.com/user-attachments/assets/af03a7a3-9c32-4402-9d85-6d6a1523de09" width="600" height="300"> | --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
On MacCatalyst, the SearchBar's X (clear) button remains visible after clearing all text.
Description of Change
Issues Fixed
Fixes #34422
Tested the behavior in the following platforms.
Before.mov
After.mov