xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug][iOS] Tapping on NavigationBar does not trigger UnFocus for Entries #15702

Open banditoth opened 1 year ago

banditoth commented 1 year ago

Description

I'm wondering if this is actually a bug or excepted behaviour on iOS. Let's make a discussion about it. When you are focusing an entry, and trying to close it by tapping on the NavigationBar's free space, the entry does not get unfocused and the virtual keyboard keeps presented.

Steps to Reproduce

  1. Create a Shell with content
  2. Place a SearchBar/Entry on content page
  3. Run the app.
  4. Click in the search bar
  5. Try closing it by tapping on the navigation bar

Expected Behavior

I assume it should close the virtual keyboard and trigger the unfocus event.

Actual Behavior

The opposite how it should work :P

Basic Information

Environment

Show/Hide Visual Studio info ``` Visual Studio Community 2022 for Mac Version 17.5 (build 1802) Installation UUID: 2c7e118d-448d-4657-90d1-cb26d316a06a Runtime .NET 7.0.1 (64-bit) Architecture: Arm64 Microsoft.macOS.Sdk 12.3.2372; git-rev-head:754abbf6a3563f6267e5717ae832b4ac25b1f2fb; git-branch:release/7.0.1xx-xcode13.3 Roslyn (Language Service) 4.5.0-3.23056.2+97881342e427ff5cdcba8f12b12ff8e6f3564431 NuGet Version: 6.4.0.117 .NET SDK (Arm64) SDK: /usr/local/share/dotnet/sdk/7.0.200/Sdks SDK Versions: 7.0.200 7.0.102 7.0.101 7.0.100 6.0.406 6.0.405 6.0.404 6.0.403 6.0.402 6.0.401 6.0.400 6.0.400-preview.22255.2 6.0.302 6.0.301 6.0.300 6.0.202 6.0.201 6.0.200 MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks .NET SDK (x64) SDK Versions: 6.0.406 6.0.405 6.0.404 6.0.403 6.0.402 6.0.401 6.0.400 6.0.302 6.0.301 6.0.300 6.0.203 6.0.202 6.0.201 6.0.200 6.0.105 6.0.102 5.0.408 5.0.407 5.0.406 5.0.405 3.1.426 3.1.425 3.1.424 3.1.423 3.1.422 3.1.421 3.1.420 3.1.419 3.1.418 3.1.417 3.1.416 .NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 7.0.3 7.0.2 7.0.1 7.0.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.4 6.0.3 6.0.2 .NET Runtime (x64) Runtime: /usr/local/share/dotnet/x64/dotnet Runtime Versions: 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 5.0.17 5.0.16 5.0.15 5.0.14 3.1.32 3.1.31 3.1.30 3.1.29 3.1.28 3.1.27 3.1.26 3.1.25 3.1.24 3.1.23 3.1.22 Xamarin.Profiler Version: 1.8.0.49 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Xamarin.Android Version: 13.2.0.0 (Visual Studio Community) Commit: xamarin-android/d17-5/797e2e1 Android SDK: /Users/banditoth/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 12.0 (API level 31) 11.0 (API level 30) 9.0 (API level 28) 13.0 (API level 33) SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 33.0.2 SDK Build Tools Version: 33.0.0 Build Information: Mono: 6dd9def Java.Interop: xamarin/java.interop/main@149d70fe SQLite: xamarin/sqlite/3.40.0@fdc1e34 Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9f02d77 Microsoft Build of OpenJDK Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk 11.0.16.1 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL Eclipse Temurin JDK Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk 1.8.0.302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL Android SDK Manager Version: 17.5.0.33 Hash: f0c0c52 Branch: remotes/origin/d17-5~2 Build date: 2023-02-14 00:26:05 UTC Android Device Manager Version: 0.0.0.1245 Hash: 7f8a990 Branch: 7f8a990 Build date: 2023-02-14 00:26:05 UTC Apple Developer Tools Xcode: 14.2 21534 Build: 14C18 Xamarin.Mac Version: 9.1.0.5 Visual Studio Community Hash: 7738c90c9 Branch: xcode14.2 Build date: 2023-01-25 15:56:14-0500 Xamarin.iOS Version: 16.2.0.5 Visual Studio Community Hash: 7738c90c9 Branch: xcode14.2 Build date: 2023-01-25 15:56:15-0500 Xamarin Designer Version: 17.5.3.47 Hash: e8b5d371c3 Branch: remotes/origin/d17-5 Build date: 2023-02-14 00:26:00 UTC Build Information Release ID: 1705001802 Git revision: bfdc90915981031f5bdda171c7eebf116a558598 Build date: 2023-02-14 00:24:08+00 Build branch: release-17.5 Build lane: release-17.5 Operating System Mac OS X 13.2.1 Darwin 22.3.0 Darwin Kernel Version 22.3.0 Mon Jan 30 20:38:37 PST 2023 root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64 ```

Workaround

Create an event subscriber for the TextChanged event, and when the text is string.isnullorempty, trigger the usercontrol's UnFocus method manually.