-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix Editor TextChanged event trimmed in iOS release builds (.NET 10) #32653
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/Controls/tests/TestCases.HostApp/Issues/EditorTextChangedIOS26.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.EditorTextChangedIOS26"> | ||
|
|
||
| <ContentPage.Content> | ||
| <VerticalStackLayout Padding="20" Spacing="10"> | ||
| <Label Text="Type text in the editor below. The counter should update as you type." | ||
| FontSize="14" | ||
| Margin="0,0,0,10"/> | ||
|
|
||
| <Editor x:Name="TestEditor" | ||
| AutomationId="TestEditor" | ||
| Placeholder="Type here to test TextChanged event" | ||
| HeightRequest="150" | ||
| TextChanged="OnEditorTextChanged"/> | ||
|
|
||
| <Label x:Name="EventCountLabel" | ||
| AutomationId="EventCountLabel" | ||
| Text="TextChanged event count: 0" | ||
| FontSize="16" | ||
| FontAttributes="Bold" | ||
| TextColor="Green"/> | ||
|
|
||
| <Label x:Name="LastTextLabel" | ||
| AutomationId="LastTextLabel" | ||
| Text="Last text: (empty)" | ||
| FontSize="14" | ||
| TextColor="Blue"/> | ||
| </VerticalStackLayout> | ||
| </ContentPage.Content> | ||
| </ContentPage> |
21 changes: 21 additions & 0 deletions
21
src/Controls/tests/TestCases.HostApp/Issues/EditorTextChangedIOS26.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 0, "Editor TextChanged event not firing on iOS 26.1 release build", | ||
| PlatformAffected.iOS)] | ||
| public partial class EditorTextChangedIOS26 : ContentPage | ||
| { | ||
| private int _eventCount = 0; | ||
|
|
||
| public EditorTextChangedIOS26() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| private void OnEditorTextChanged(object sender, TextChangedEventArgs e) | ||
| { | ||
| _eventCount++; | ||
| EventCountLabel.Text = $"TextChanged event count: {_eventCount}"; | ||
| LastTextLabel.Text = $"Last text: {(string.IsNullOrEmpty(e.NewTextValue) ? "(empty)" : e.NewTextValue)}"; | ||
| } | ||
| } | ||
| } | ||
48 changes: 48 additions & 0 deletions
48
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/EditorTextChangedIOS26.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| internal class EditorTextChangedIOS26 : _IssuesUITest | ||
| { | ||
| public override string Issue => "Editor TextChanged event not firing on iOS 26.1 release build"; | ||
|
|
||
| public EditorTextChangedIOS26(TestDevice device) : base(device) | ||
| { | ||
| } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Editor)] | ||
| public void EditorTextChangedEventShouldFireOnTextInput() | ||
| { | ||
| // Wait for the editor to be visible | ||
| App.WaitForElement("TestEditor"); | ||
|
|
||
| // Verify initial state | ||
| var initialCount = App.FindElement("EventCountLabel").GetText(); | ||
| Assert.That(initialCount, Is.EqualTo("TextChanged event count: 0")); | ||
|
|
||
| // Type text in the editor | ||
| App.Tap("TestEditor"); | ||
| App.EnterText("TestEditor", "Hello"); | ||
|
|
||
| // Wait a bit for the event to fire | ||
| App.WaitForElement("EventCountLabel"); | ||
|
|
||
| // Verify that TextChanged event was fired | ||
| var eventCount = App.FindElement("EventCountLabel").GetText(); | ||
| Assert.That(eventCount, Does.Contain("TextChanged event count:")); | ||
|
|
||
| // The count should be greater than 0, indicating the event fired | ||
| // Extract the number from "TextChanged event count: X" | ||
| var countText = eventCount.Replace("TextChanged event count:", "").Trim(); | ||
| int count = int.Parse(countText); | ||
| Assert.That(count, Is.GreaterThan(0), "TextChanged event should have fired at least once"); | ||
|
|
||
| // Verify the text was captured | ||
| var lastText = App.FindElement("LastTextLabel").GetText(); | ||
| Assert.That(lastText, Does.Contain("Hello"), "Last text should contain the entered text"); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The Issue attribute uses
0for the issue number, but according to the PR description, this PR fixes issue #32651. The issue number in the Issue attribute should be updated to match the actual GitHub issue number.Update the issue number from:
To: