diff --git a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/TextBoxTests/TextBoxTests.cs b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/TextBoxTests/TextBoxTests.cs
index 8269f5370072..e096036193fa 100644
--- a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/TextBoxTests/TextBoxTests.cs
+++ b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/TextBoxTests/TextBoxTests.cs
@@ -848,5 +848,26 @@ private static PointF GetPixelPositionWithColor(ScreenshotInfo screenshotInfo, I
throw new InvalidOperationException($"Color {expectedColor} was not found.");
}
+
+ [Test]
+ [AutoRetry]
+ [ActivePlatforms(Platform.Browser)]
+ public void TextBox_WithPadding_Focus()
+ {
+ Run("UITests.Windows_UI_Xaml_Controls.TextBox.TextBox_WithPadding_Focus");
+
+ const string Text = "asdqwe";
+
+ foreach (var marked in new[] { "textBox1", "textBox2" })
+ {
+ // tap near the edge (area pushed/occupied by TextBox.Padding)
+ var rect = _app.GetPhysicalRect(marked);
+ _app.TapCoordinates(rect.Right - 5, rect.Bottom - 5);
+ _app.Wait(seconds: 1);
+
+ _app.EnterText(Text);
+ _app.WaitForText(marked, Text, timeout: TimeSpan.FromSeconds(20));
+ }
+ }
}
}
diff --git a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Input/VisualState_Tests.cs b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Input/VisualState_Tests.cs
index a95e87b011b1..bc084e59a483 100644
--- a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Input/VisualState_Tests.cs
+++ b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Input/VisualState_Tests.cs
@@ -131,7 +131,7 @@ public void TestTextBoxReleaseOutFocused()
[Test]
[AutoRetry]
- [ActivePlatforms(Platform.Android, Platform.iOS)] // For touch, focus should be set only when released outside of TextBox
+ [ActivePlatforms(/*Platform.Android, */Platform.iOS)] // For touch, focus should be set only when released outside of TextBox
public void TestTextBoxReleaseOutUnfocused()
{
Run("UITests.Shared.Windows_UI_Input.VisualStatesTests.TextBox_VisualStates");
diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
index fc23e1ec9711..ab8c57309326 100644
--- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
+++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
@@ -1885,6 +1885,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -5663,6 +5667,9 @@
TextBox_TextChanging.xaml
+
+ TextBox_WithPadding_Focus.xaml
+
TextBox_Wrapping.xaml
diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBox/TextBox_WithPadding_Focus.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBox/TextBox_WithPadding_Focus.xaml
new file mode 100644
index 000000000000..aeba7dae0e65
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBox/TextBox_WithPadding_Focus.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBox/TextBox_WithPadding_Focus.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBox/TextBox_WithPadding_Focus.xaml.cs
new file mode 100644
index 000000000000..501dae7561c2
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBox/TextBox_WithPadding_Focus.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Uno.UI.Samples.Controls;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+namespace UITests.Windows_UI_Xaml_Controls.TextBox
+{
+ [SampleControlInfo(nameof(TextBox), nameof(TextBox_WithPadding_Focus))]
+ public sealed partial class TextBox_WithPadding_Focus : UserControl
+ {
+ public TextBox_WithPadding_Focus()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.cs b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.cs
index cc10e6508cb9..303d7627f864 100644
--- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.cs
+++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.cs
@@ -792,6 +792,15 @@ protected override void OnPointerReleased(PointerRoutedEventArgs args)
args.Handled = true;
}
+ protected override void OnTapped(TappedRoutedEventArgs e)
+ {
+ base.OnTapped(e);
+
+ OnTappedPartial();
+ }
+
+ partial void OnTappedPartial();
+
///
protected override void OnKeyDown(KeyRoutedEventArgs args)
{
diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs
index c6130db70ac1..ea2f8012cc51 100644
--- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs
+++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs
@@ -50,6 +50,13 @@ partial void InitializePropertiesPartial()
{
AddHandler(PointerReleasedEvent, (PointerEventHandler)OnHeaderClick, true);
}
+
+ SetStyle("cursor", "text");
+ }
+
+ partial void OnTappedPartial()
+ {
+ FocusTextView();
}
private void OnHeaderClick(object sender, object args)