[iOS] Fix Label with TailTruncation not rendering after empty-to-non-empty text transition#34812
Conversation
🧪 PR Test EvaluationOverall Verdict: ✅ Tests are adequate The test directly exercises the exact bug scenario — a
📊 Expand Full EvaluationPR Test Evaluation ReportPR: #34812 — [iOS] Fix Label with TailTruncation not rendering after empty-to-non-empty text transition Overall Verdict✅ Tests are adequate The test correctly targets the reported failure scenario and directly verifies the observable outcome of the fix. 1. Fix Coverage — ✅The fix adds a new condition in if (TextChangedShouldInvalidateMeasure(label) || (wasEmpty != isEmpty && IsLabelSizeable(label)))
label.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);The test creates a 2. Edge Cases & Gaps —
|
| Fix | Test |
|---|---|
Label.cs — measure invalidation for empty↔non-empty transitions |
Creates Label with TailTruncation + null text, taps button to set text, checks non-zero height |
Targets IsLabelSizeable labels in VerticalStackLayout (vertically sizable, horizontally fixed) |
Uses VerticalStackLayout, so label is exactly horizontally fixed + vertically sizable |
Perfect alignment between fix and test.
Recommendations
- (Optional, low-priority) Add a test step for the
"" → "Test"transition to cover thestring.IsNullOrEmpty("")path explicitly, though this is not blocking. - (Optional) Consider verifying that the label also reverts to zero height (or near-zero) when text is cleared back to null/empty, to guard against future regressions in that direction.
Warning
⚠️ Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
dc.services.visualstudio.com
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "dc.services.visualstudio.com"See Network Configuration for more information.
Note
🔒 Integrity filtering filtered 1 item
Integrity filtering activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
- pr:[iOS] Fix Label with TailTruncation not rendering after empty-to-non-empty text transition #34812 (
pull_request_read: Resource 'pr:[iOS] Fix Label with TailTruncation not rendering after empty-to-non-empty text transition #34812' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)
🧪 Test evaluation by Evaluate PR Tests
…empty text transition (#34812) <!-- 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! ### Context This is a retarget of #34698 from `inflight/candidate` to `inflight/current`. The candidate branch has already been stabilized and merging additional changes there could introduce new test failures. ### Issue Details - When a Label is initialized with LineBreakMode="TailTruncation" and its Text is null or empty during the first render, later updates to the Text property do not render any visible text on iOS. The label remains visually empty even though the Text value changes successfully. ### Root Cause - **Regression**: Introduced by PR #28931 - PR #28931 introduced ComputeConstraintForView on several layouts, which causes a Label with default HorizontalOptions = Fill (e.g., inside a VerticalStackLayout) to be marked as HorizontallyFixed. This activates an existing optimization in TextChangedShouldInvalidateMeasure that skips InvalidateMeasureInternal for labels that are both single-line and horizontally fixed. - This optimization is valid for typical text changes (e.g., "Hello" → "World") where the height remains unchanged. However, it fails for the empty → non-empty transition. When a label initially has null/empty text, iOS measures it with a height of 0, and MAUI caches this value. When text is later assigned, the optimization prevents re-measurement, leaving the stale 0-height intact—resulting in the label being invisible despite having text. ### Description of Change - Updated OnTextPropertyChanged in Label.cs to always invalidate measure when the label's text transitions between empty and non-empty, ensuring the label is properly rendered and sized in scenarios like TailTruncation. ### Issues Fixed Fixes #34591 ### Original PR Cherry-pick of #34698 by @SyedAbdulAzeemSF4852 Co-authored-by: SyedAbdulAzeemSF4852 <184361905+SyedAbdulAzeemSF4852@users.noreply.github.com> 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!
Context
This is a retarget of #34698 from
inflight/candidatetoinflight/current. The candidate branch has already been stabilized and merging additional changes there could introduce new test failures.Issue Details
Root Cause
Description of Change
Issues Fixed
Fixes #34591
Original PR
Cherry-pick of #34698 by @SyedAbdulAzeemSF4852