Repository navigation
[NET12] [Enhancement]Add optional initial-value preselection to DisplayPromptAsync - #40291
devanathan-vaithiyanathan wants to merge 20 commits into
Conversation
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.
This comment has been minimized.
This comment has been minimized.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
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.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Expert Review — No more findings
Reviewed commit 2b1c152.
Selected Tests🧪 Test selection — click to expand
🧪 UI tests —
|
| Platform | Categories |
|---|---|
| Android | DisplayPrompt |
| iOS | DisplayPrompt |
| MacCatalyst | DisplayPrompt |
| Windows | DisplayPrompt |
🧪 Device tests — Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior +52 on Android, iOS, MacCatalyst, Windows
❌ Could not queue maui-pr-devicetests: Azure Pipelines did not start maui-pr-devicetests for the dispatch branch run-devicetests/pr40291-46592893599 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-devicetests for the full suite.
GPT-6.2 Sol: Run Controls device tests on all four platforms to include the uncategorized native prompt selection tests.
MAI Code 2: Prompt selection device coverage; runs Controls.Page device tests on Android, iOS, Mac Catalyst, and Windows.
🧪 Running — 56 categories on Android, iOS, MacCatalyst, Windows
| Platform | Categories |
|---|---|
| Android | 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.Editor, 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 |
| iOS | 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.Editor, 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 |
| MacCatalyst | 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.Editor, 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 |
| Windows | 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.Editor, 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 |
⏭️ Skipped — what neither suite runs
UI tests — 76 categories, 0 platforms
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, DragAndDrop, Entry, Editor, 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 — 49 categories, 0 platforms
Categories not run: Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, 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 | DisplayPrompt |
DisplayPrompt |
| iOS | DisplayPrompt |
DisplayPrompt |
| MacCatalyst | DisplayPrompt |
DisplayPrompt |
| Windows | DisplayPrompt |
DisplayPrompt |
GPT-6.2 Sol — Run DisplayPrompt UI tests on Android, iOS, Mac Catalyst, and Windows for the new initial selection behavior.
- Issue4981 adds runnable DisplayPrompt tests on all four platforms.
- AlertManager and PromptDialog change native prompt selection, not Entry or Material3 rendering.
- Other Apple dialogs do not use the new presentation callback.
MAI Code 2 — Prompt initial-selection support; runs DisplayPrompt UI tests on Android, iOS, Mac Catalyst, and Windows.
- Platform-specific AlertManager changes affect prompt text selection on Android, Windows, iOS, and Mac Catalyst.
- The new shared Issue4981 UI tests are tagged DisplayPrompt and runnable on all four platforms.
- Page API and public-surface changes are covered by the focused prompt interaction tests; no unrelated controls or full run are needed.
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 | 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.Editor, 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 |
Controls.Page |
| iOS | 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.Editor, 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 |
Controls.Page |
| MacCatalyst | 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.Editor, 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 |
Controls.Page |
| Windows | 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.Editor, 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 |
Controls.Page |
GPT-6.2 Sol — Run Controls device tests on all four platforms to include the uncategorized native prompt selection tests.
- PromptSelectionTests covers native ranges, caret placement, and platform-specific focus or reopen behavior.
- The new classes lack a category, so Controls.Page alone would miss them.
- No other device test project is affected.
MAI Code 2 — Prompt selection device coverage; runs Controls.Page device tests on Android, iOS, Mac Catalyst, and Windows.
- Changes live in Controls Page and platform prompt implementations across all four platforms.
- New prompt-selection device tests exercise the native prompt fields on Android, Windows, iOS, and Mac Catalyst under the Page test area.
- No shared base handler, layout, Graphics, Essentials, or build infrastructure is changed, so broader device suites are omitted.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
MAUI Autopilot — Ready for maintainer reviewResults
Needs a decisionLeft unchanged; the reason is in each thread. |
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!
Target Branch
mainnet11, for reviewFor .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
Adds initial text selection support to
Page.DisplayPromptAsyncon Android, iOS, Mac Catalyst, and Windows through a newinitialSelectionargument.Callers can select the complete initial value, select a range, or place the caret at a specific position.
PromptTextSelection.Nonerequests no selection and places the caret at the end.The existing prompt signature is retained. When selection is omitted or
null, Android and iOS retain their native behavior; Mac Catalyst and Windows place the caret at the end without selecting text.Note
By default, text is not selected on Windows, Android, and iOS, whereas on
Mac Catalyst, the text is selected. To achieve consistent behavior across all
platforms, use
PromptTextSelection.Noneto prevent text selection on Mac Catalyst.Issues Fixed
Fixes #4981
Motivation
Applications often provide suggested values in prompts. Selecting the whole value makes replacement convenient, while selecting part of it lets users edit only the relevant portion, such as
ReportinReport.pdf.The earlier Boolean approach could request full selection but could not express a partial range or caret position. This change uses one selection argument for all of these cases without requiring a custom prompt.
Public API
PromptTextSelectionPreset.All/NonePromptTextSelection.All/NonePromptTextSelection(int start, int length)PromptTextSelection.Start/LengthPromptTextSelection.IsAll/IsNonePage.DisplayPromptAsync(..., PromptTextSelectionPreset initialSelection)Page.DisplayPromptAsync(..., PromptTextSelection initialSelection)null.PromptArguments.InitialSelectionPromptDialog.InitialSelectionThe original
DisplayPromptAsyncoverload andPromptArgumentsconstructor remain available. The two new prompt overloads require all nine arguments, preserving overload resolution for existing calls with positionalnullordefaultarguments.PromptTextSelectionrejects negative coordinates, and undefined preset values are rejected. Preset requests are distinct from an explicit(0, 0)range.Usage
Select all
Typing
Xreplaces the complete value withX.Select a range
Only
Reportis selected; typingXproducesX.pdf.Place the caret
The caret is placed before
.pdf; typingXproducesReportX.pdf.Request no selection
The caret is placed at the end; typing
XproducesReport.pdfX.Use the existing overload
No explicit selection is supplied. Platform-specific default behavior is
described below.
What Changed
Shared API and selection logic
src/Controls/src/Core/PromptTextSelection.cssrc/Controls/src/Core/Page/Page.cssrc/Controls/src/Core/PromptArguments.csPublicAPI.Unshipped.txtfilesSelection coordinates are UTF-16 code-unit offsets. Ranges are resolved against the text actually displayed by the native control: the start is clamped to the text length, and the length is clamped to the remaining text. This also avoids overflow for very large coordinates.
Platform implementations
src/Controls/src/Core/Platform/AlertManager/AlertManager.Android.cssrc/Controls/src/Core/Platform/AlertManager/AlertManager.iOS.csEditingDidBeginhandler and removes the handler on prompt completion. A null request leaves native selection behavior unchanged.src/Controls/src/Core/Platform/AlertManager/AlertManager.iOS.csNoneto prevent automatic selection.src/Controls/src/Core/Platform/AlertManager/AlertManager.Windows.cs,PromptDialog.Windows.csPromptDialogand applies it in a one-timeOpenedhandler. A null request is treated asNone, placing the caret at the end.Output Reference
These recordings were supplied for the earlier Boolean implementation. Confirm that they match the final behavior before using them as validation; partial-selection and caret-placement scenarios still need validation.
Windows.mp4
Android.mov
iOS.mov
Mac.mov
Key Behaviors
Allselects the complete displayed text;Noneplaces the caret at the end.ArgumentOutOfRangeException.nullselection preserves native behavior on Android and iOS. Mac Catalyst and Windows instead place the caret at the end.Tests and Validation
nullanddefault.AllandNone, plus an iOS typing and result check.