Repository navigation
[iOS] Size the Editor to its placeholder when AutoSize is TextChanges - #40620
Conversation
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> <!-- maui-release-normalization:production:11.0.1xx-sr2 --> Restore **`net11`** to the next-cycle CI version after pinning the exact SR2 staging source. Approved candidate merge: `cb744cbefe0ca371b6331e5afb711bd03ce1c37d`. Prepared normalization: `084e9e5a4ce38d205bf9f9cdc6933fbddf7c91e7`. This pinned child commit changes only version metadata: patch 30, CI/non-stable settings, and that same plain version in both bug-template dropdowns. SDK band and release contents are unchanged. **A maintainer must review this PR, run required CI and use Create a merge commit. Do not squash or rebase.** The reconciler does not update the protected integration ref, approve, retarget or merge this PR. Next-lane activation and forward-flow preparation wait for the normalization ancestry to be verified. The automation/release staging ref starts at this candidate source and advances through its separately reviewed servicing PR. A newer maintainer candidate merge supersedes the old generation, never a concurrent unrelated edit. After servicing is merged with Create a merge commit, the real release branch is manually cut at its exact merge. This normalization PR does not authorize signing. ### 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. --> N/A - staged release configuration. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> <!-- maui-release-normalization:production:11.0.1xx-sr2 --> Restore **`net11`** to the next-cycle CI version after pinning the exact SR2 staging source. Approved candidate merge: `cb744cbefe0ca371b6331e5afb711bd03ce1c37d`. Prepared normalization: `084e9e5a4ce38d205bf9f9cdc6933fbddf7c91e7`. This pinned child commit changes only version metadata: patch 30, CI/non-stable settings, and that same plain version in both bug-template dropdowns. SDK band and release contents are unchanged. **A maintainer must review this PR, run required CI and use Create a merge commit. Do not squash or rebase.** The reconciler does not update the protected integration ref, approve, retarget or merge this PR. Next-lane activation and forward-flow preparation wait for the normalization ancestry to be verified. The automation/release staging ref starts at this candidate source and advances through its separately reviewed servicing PR. A newer maintainer candidate merge supersedes the old generation, never a concurrent unrelated edit. After servicing is merged with Create a merge commit, the real release branch is manually cut at its exact merge. This normalization PR does not authorize signing. Replaces dotnet#40563, which landed the same tree without the pinned commit (squash or rebase merge). This PR may show no remaining file changes; merging it with Create a merge commit records the required ancestry. ### 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. --> N/A - staged release configuration. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… height (dotnet#40574) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> Ports the exact fix and regression tests from dotnet#40572 to `net11` for review. Original fix by @devanathan-vaithiyanathan. The SR2 PR remains separate. For horizontal Grid CollectionViews on iOS and Mac Catalyst, measure the first available item when the height is unbounded, skip empty leading groups, and account for the row span and vertical spacing. The existing linear and finite-height behavior is unchanged. Regression coverage includes a four-row grid in an Auto row and a grouped grid with an empty first group. The local iOS device-test build was blocked by a missing workload in the repository SDK (NETSDK1147), so the simulator tests did not run. Mac Catalyst was not run locally. ### 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 dotnet#40466 <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…0578) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> Backport dotnet#40481 from `release/11.0.1xx-sr2` to `net11`. The change prevents re-entrant CollectionView remaining-items threshold notifications and skips threshold evaluation when the scrolled event replaces the items source. It includes the original iOS/MacCatalyst device tests. Source commit: `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`. **Validation** - `git diff --cached --check` - passed. - `git diff --cached | git patch-id --stable` - matched the patch ID of source commit `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`. - Building `Microsoft.Maui.BuildTasks.slnf` failed locally with `NETSDK1140`: the installed Apple workload accepts platform version 27.2 while the projects request 27.0. - iOS and MacCatalyst device tests were not run locally; CI validation is required. ### 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. --> Relates to dotnet#40467. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. -->
An Editor with AutoSize="TextChanges" is measured from its text only. With no text and a placeholder longer than one line, the editor stays one line high and the placeholder is truncated, also when the placeholder or AutoSize change at runtime. MauiTextView now includes the placeholder height in SizeThatFits while auto growth is allowed and the placeholder is visible. Changing the placeholder, or switching AutoSize, invalidates the measure. Editors with AutoSize disabled keep their size. Fixes dotnet#30571
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Hey there @marcelomoresco! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/review expert-review |
There was a problem hiding this comment.
Expert Review — 3 findings
Reviewed commit 0472bf2.
Source assessment incomplete (13/14 dimensions); finding count is partial.
See inline comments for details.
An auto-growing Editor measured its placeholder with the parent's width, so with WidthRequest or a smaller MaximumWidth the editor was too short for the arranged width and the placeholder was clipped. The requested width is now applied before measuring, and the measured width covers the placeholder when the editor sizes to its content. VerticalTextAlignment Center and End ignored the placeholder height and shifted it out of the editor. The placeholder height is now part of the content height used for alignment, and a stale negative offset is cleared when there is no free space. The device test goes through the Controls Editor and its handler: runtime Placeholder and AutoSize changes, entering and clearing text, and all vertical alignments.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…log refused dispatches (#40631) ### Description of Change **Crash (from #40627).** Every `/review run-tests` dispatch since #40627 fails before posting its comment: ``` Invoke-RunTests.ps1:380 … -RunTestsStatuses -Repository $Repository -Sha $sha) | Where-Object { You cannot call a method on a null-valued expression. ``` `Get-RunTestsStatuses` returns its list as a single object (`return , @(…)`), so `@(Get-RunTestsStatuses …)` nested it and `$_.context` was the whole list. The list is now assigned first, and `context` is read as a string. Seen on #40439 and #40294. **net11 dispatches refused (diagnostics).** Since #40629 merged into `net11`, creating the `run-tests/*` / `run-devicetests/*` branch for `net11` PRs fails with `Resource not accessible by integration (HTTP 403)` (#40619, #40620, #40621). `main` PRs and `net11` dispatches before that pushed fine. The log doesn't say what GitHub objects to, so when the branch can't be created the script now logs the dispatch commit, its parent, the test-merge and its base, and the files the commit changes. That shows the cause on the next run. ### Testing - New Pester test: `Get-RunTestsStatuses` returns a flat list, and `Invoke-RunTests.ps1` no longer wraps it in `@()`. 77 pass; the 2 failures (`Pipeline templates`, `gates the device test pipeline on the dispatch request`) also fail on `main` without this change. - Called `Get-RunTestsStatuses` against a real commit (#40611 head): 7 statuses, filtering works. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
…log refused dispatches (dotnet#40631) ### Description of Change **Crash (from dotnet#40627).** Every `/review run-tests` dispatch since dotnet#40627 fails before posting its comment: ``` Invoke-RunTests.ps1:380 … -RunTestsStatuses -Repository $Repository -Sha $sha) | Where-Object { You cannot call a method on a null-valued expression. ``` `Get-RunTestsStatuses` returns its list as a single object (`return , @(…)`), so `@(Get-RunTestsStatuses …)` nested it and `$_.context` was the whole list. The list is now assigned first, and `context` is read as a string. Seen on dotnet#40439 and dotnet#40294. **net11 dispatches refused (diagnostics).** Since dotnet#40629 merged into `net11`, creating the `run-tests/*` / `run-devicetests/*` branch for `net11` PRs fails with `Resource not accessible by integration (HTTP 403)` (dotnet#40619, dotnet#40620, dotnet#40621). `main` PRs and `net11` dispatches before that pushed fine. The log doesn't say what GitHub objects to, so when the branch can't be created the script now logs the dispatch commit, its parent, the test-merge and its base, and the files the commit changes. That shows the cause on the next run. ### Testing - New Pester test: `Get-RunTestsStatuses` returns a flat list, and `Invoke-RunTests.ps1` no longer wraps it in `@()`. 77 pass; the 2 failures (`Pipeline templates`, `gates the device test pipeline on the dispatch request`) also fail on `main` without this change. - Called `Get-RunTestsStatuses` against a real commit (dotnet#40611 head): 7 statuses, filtering works. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Selected Tests
🧪 Test selection — click to expand
🧪 UI tests —
|
| Platform | Categories |
|---|---|
| iOS | Editor |
| MacCatalyst | Editor |
📊 Results — succeeded: 3 passed, 0 failed of 3 jobs
🔗 All test results · Build logs
| Job | Result |
|---|---|
| Build UITests CoreCLR Sample App Build Sample App | ✅ succeeded |
| iOS UITests CoreCLR Controls (vlatest) Editor | ✅ succeeded |
| MacCatalyst UITests CoreCLR Controls Editor | ✅ succeeded |
🧪 Device tests — Controls.Editor, Core.Editor on iOS, MacCatalyst
✅ maui-pr-devicetests #1701086 passed.
GPT-6.2 Sol: Run Controls.Editor and Core.Editor device tests on iOS and Mac Catalyst for the placeholder sizing and layout regressions.
MAI Code 2: iOS/Mac Catalyst Editor handler and control measurement changes; runs Editor device tests at both Controls and Core levels.
🧪 Ran — 2 categories on iOS, MacCatalyst
| Platform | Categories |
|---|---|
| iOS | Controls.Editor, Core.Editor |
| MacCatalyst | Controls.Editor, Core.Editor |
📊 Results — succeeded: 3 passed, 0 failed of 3 jobs
🔗 All test results · Build logs
⏭️ Skipped — what neither suite runs
UI tests — 76 categories, 2 platforms
Platforms not run: Android, Windows
Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Effects, Essentials, FlyoutPage, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, Lifecycle, ManualReview, Maps, Navigation, Page, Performance, Picker, ProgressBar, RadioButton, RefreshView, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, Shell1, Shell2, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, Window, WebView, Material3
Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.
Device tests — 103 categories, 2 platforms
Platforms not run: Android, Windows
Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.FlyoutPage, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Lifecycle, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Modal, Controls.NavigationPage, Controls.Page, Controls.PageTransitions, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.RefreshView, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Shell, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.Window, Controls.WindowOverlay, Controls.Xaml, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay, Graphics, Essentials, BlazorWebView
Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.
🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)
UI tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | — | — |
| iOS | Editor |
Editor |
| MacCatalyst | Editor |
Editor |
| Windows | — | — |
GPT-6.2 Sol — Run Editor UI tests on iOS and Mac Catalyst for the autosizing placeholder fix.
- Editor.iOS.cs and EditorHandler.iOS.cs change autosizing and measure invalidation.
- MauiTextView measures and aligns the visible placeholder when auto-growth is on.
- Both Apple targets share this code; no other controls or platforms are affected.
MAI Code 2 — iOS/Mac Catalyst Editor auto-sizing fix; runs Editor UI tests on both Apple UI platforms.
Editor.iOS.cs,EditorHandler.iOS.cs, andMauiTextView.cschange Editor measurement and auto-growth on shared Apple platform code.- Run
EditorUI coverage on iOS and Mac Catalyst because placeholder sizing andAutoSizeinvalidation can affect Editor layout. - Do not run Android or Windows; the changed production files are iOS-specific, with no corresponding platform-independent change.
- No full run: the blast radius is limited to the Editor control and its platform sizing path.
Device tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | — | — |
| iOS | Controls.Editor, Core.Editor |
Controls.Editor, Core.Editor |
| MacCatalyst | Controls.Editor, Core.Editor |
Controls.Editor, Core.Editor |
| Windows | — | — |
GPT-6.2 Sol — Run Controls.Editor and Core.Editor device tests on iOS and Mac Catalyst for the placeholder sizing and layout regressions.
- Controls Editor tests exercise runtime AutoSize, text, placeholder, and alignment changes.
- Core Editor handler tests check native sizing with auto-growth on and off.
- Both Apple targets share the implementation; no other units are needed.
MAI Code 2 — iOS/Mac Catalyst Editor handler and control measurement changes; runs Editor device tests at both Controls and Core levels.
- The Controls Editor mapper and Core Editor handler both changed, so select
Controls.EditorandCore.Editor. - PR-specific device tests were added in both Controls and Core Editor test areas and should run on iOS and Mac Catalyst.
- Limit platforms to iOS and Mac Catalyst because all changed production code is under the Apple
.iOSpath. - No full run or unrelated categories: the changes are confined to Editor placeholder measurement, invalidation, and auto-growth behavior.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
…ze-net11 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Resolved the conflict with the SR3 candidate in |
Target Branch
Targets
net11: longstanding bug (reported 10.0.0-preview.1), same code onmain.Description of Change
An
EditorwithAutoSize="TextChanges"is measured from its text only. With no text and a placeholder longer than one line, the editor stays one line high and the placeholder is truncated — also when the placeholder orAutoSizechange at runtime.MauiTextView.SizeThatFitsnow also considers the placeholder height while auto growth is allowed and the placeholder is visible. Changing the placeholder, or switchingAutoSize, invalidates the measure.AutoSizedisabled: unchanged.Note: adds
override MauiTextView.SizeThatFitstoPublicAPI.Unshippedfor net-ios/net-maccatalyst — it's an override of an existing UIView method, no new public member, but shows up in the API file.Verification
iOS 26.5 simulator (same change backported to tag 10.0.90): before, editor stays 33pt with a placeholder that needs 50; after, 66pt with the full placeholder. AutoSize off: unchanged. Typing, deleting, and changing the placeholder at runtime all work. Core/Core.DeviceTests compile on net11.0-ios27.2.
Not verified: the new device test (Xcode 26.6), Mac Catalyst, iOS 27, real device.
Issues Fixed
Fixes #30571