Skip to content

Commit 5aadeb8

Browse files
Remove obsolete TextField factory (#390)
* Remove obsolete TextField factory Remove the deprecated TextField factory alias so TextBox is the only text-input DSL factory. Update analyzer, localization scanner, docs, samples, gallery labels, and tests to use TextBox naming. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address TextBox naming feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 16a0cc2 commit 5aadeb8

48 files changed

Lines changed: 196 additions & 213 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,12 @@ to land under these conventions; subsequent specs follow this shape.
2929

3030
### Changed
3131

32-
- **`TextField``TextBox` rename.** The record type
33-
`TextFieldElement` is renamed to `TextBoxElement` for parity with
34-
WinUI's `Microsoft.UI.Xaml.Controls.TextBox`. The `TextField(...)`
35-
factory remains as a non-erroring `[Obsolete]` forwarding alias for
36-
one release; call sites should migrate to `TextBox(...)`. The
37-
alias will be removed in a future release.
32+
- **`TextBox` is now the only text-input factory.** The deprecated
33+
`TextField(...)` forwarding alias has been removed after the
34+
`TextFieldElement``TextBoxElement` rename. Use `TextBox(...)`.
3835

3936
### Deprecated
4037

41-
- **`Factories.TextField(...)`** — use `Factories.TextBox(...)` instead.
42-
Emits `CS0618` warning; will be removed in a future release.
43-
4438
- **Spec 045 Phase 2 — §2.29 ready for human review gate.**
4539
Every Phase-2 implementation item in
4640
`docs/specs/tasks/045-docking-windows-implementation.md` is now

samples/CommandingDemo/App.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public override Element Render()
5858

5959
// Tracks a one-shot selection we want to apply after a programmatic
6060
// text mutation (Cut/Paste/SelectAll). Cleared back to null as soon
61-
// as the TextField consumes it, so normal user clicks don't trigger
61+
// as the TextBox consumes it, so normal user clicks don't trigger
6262
// a programmatic selection write.
6363
var (pendingSelection, setPendingSelection) = UseState<(int Start, int Length)?>(null);
6464

@@ -131,7 +131,7 @@ public override Element Render()
131131
SelectionLength = pendingSelection?.Length,
132132
}).Margin(horizontal: 16, vertical: 8),
133133

134-
// Clear the pending selection once the TextField has had a chance
134+
// Clear the pending selection once the TextBox has had a chance
135135
// to apply it. Runs after render; no-op when nothing pending.
136136
PendingSelectionConsumer(pendingSelection, setPendingSelection),
137137

samples/Reactor.TestApp/Demos/InputGesturesDemo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public override Element Render()
247247
var (name, setName) = UseState("");
248248
var (inputRef, requestFocus) = this.UseElementFocus();
249249

250-
// Deliberately NOT auto-focusing on mount in this gallery: a TextField
250+
// Deliberately NOT auto-focusing on mount in this gallery: a TextBox
251251
// deep inside a ScrollView that takes focus pulls the viewport down via
252252
// WinUI's BringIntoView — and it re-triggers every time the window
253253
// regains foreground. Real apps that auto-focus a first input (login

samples/ReactorGallery/ControlPages/BasicInput/TextFieldPage.cs renamed to samples/ReactorGallery/ControlPages/BasicInput/TextBoxPage.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace WinUIGalleryReactor.ControlPages.BasicInput;
99

10-
class TextFieldPage: Component
10+
class TextBoxPage: Component
1111
{
1212
public override Element Render()
1313
{
@@ -19,17 +19,17 @@ public override Element Render()
1919
var (urlText, setUrlText) = UseState("");
2020

2121
return ScrollView(VStack(16,
22-
PageHeader("TextField", "A single-line or multi-line plain text input field."),
22+
PageHeader("TextBox", "A single-line or multi-line plain text input field."),
2323

24-
SampleCard("Basic TextField",
24+
SampleCard("Basic TextBox",
2525
VStack(8,
2626
TextBox(text, v => setText(v), "Type here..."),
2727
TextBlock($"Characters: {text.Length}").Foreground(Theme.SecondaryText)),
2828
sourceCode: @"
2929
TextBox(text, v => setText(v), ""Type here..."")
3030
"),
3131

32-
SampleCard("Multiline TextField",
32+
SampleCard("Multiline TextBox",
3333
TextBox(multiline, v => setMultiline(v), "Enter multiple lines...")
3434
.Set(tb => { tb.AcceptsReturn = true; tb.TextWrapping = TextWrapping.Wrap; })
3535
.Height(120),
@@ -39,7 +39,7 @@ public override Element Render()
3939
.Height(120)
4040
"),
4141

42-
SampleCard("TextField with Header",
42+
SampleCard("TextBox with Header",
4343
TextBox(headerText, v => setHeaderText(v), "user@example.com").Header("Email"),
4444
sourceCode: @"
4545
TextBox(headerText, v => setHeaderText(v), ""user@example.com"").Header(""Email"")

samples/ReactorGallery/ControlPages/DesignGuidance/SpacingPage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static Element SpacingScaleSection()
7575
static Element MarginVsPaddingSection() =>
7676
SampleCard("Margin vs Padding",
7777
VStack(16,
78-
TextBlock("Margin adds space outside an element; Padding adds space inside. In Reactor, .Padding() only works on Border and Control elements (Button, TextField, etc.). Layout panels like VStack and HStack only support .Margin() — wrap content in a Border if you need inner padding on a stack.")
78+
TextBlock("Margin adds space outside an element; Padding adds space inside. In Reactor, .Padding() only works on Border and Control elements (Button, TextBox, etc.). Layout panels like VStack and HStack only support .Margin() — wrap content in a Border if you need inner padding on a stack.")
7979
.Foreground(Theme.SecondaryText)
8080
.FontSize(13)
8181
.Set(tb => tb.TextWrapping = TextWrapping.Wrap)
@@ -140,7 +140,7 @@ static Element MarginVsPaddingSection() =>
140140
VStack(2,
141141
CompatRow("Border", true, true),
142142
CompatRow("Button", true, true),
143-
CompatRow("TextField", true, true),
143+
CompatRow("TextBox", true, true),
144144
CompatRow("Text", true, false),
145145
CompatRow("VStack", true, false),
146146
CompatRow("HStack", true, false),
@@ -153,7 +153,7 @@ static Element MarginVsPaddingSection() =>
153153
VStack(children).Margin(16)
154154
Border(child).Margin(12)
155155
156-
// Padding — only on Border and Control (Button, TextField, etc.)
156+
// Padding — only on Border and Control (Button, TextBox, etc.)
157157
Border(child).Padding(16) // ✓ works
158158
Button(""Go"").Padding(12) // ✓ works
159159

samples/ReactorGallery/ControlRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static class ControlRegistry
2727
new("RepeatButton", "A button that raises click events repeatedly while pressed.", "Basic Input", "\uE73A", "repeat-button", "RepeatButton.png"),
2828
new("Slider", "A control that lets the user select from a range of values by moving a thumb.", "Basic Input", "\uE73A", "slider", "Slider.png"),
2929
new("SplitButton", "A button with two parts: a primary action and a flyout menu.", "Basic Input", "\uE73A", "split-button", "SplitButton.png"),
30-
new("TextField", "A single-line or multi-line plain text input field.", "Basic Input", "\uE73A", "text-field", "TextBox.png"),
30+
new("TextBox", "A single-line or multi-line plain text input field.", "Basic Input", "\uE73A", "text-box", "TextBox.png"),
3131
new("ToggleButton", "A button that can be toggled between two states.", "Basic Input", "\uE73A", "toggle-button", "ToggleButton.png"),
3232
new("ToggleSwitch", "A switch that toggles between two mutually exclusive states.", "Basic Input", "\uE73A", "toggle-switch", "ToggleSwitch.png"),
3333

samples/ReactorGallery/PageRouter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static class PageRouter
2525
"repeat-button" => Component<ControlPages.BasicInput.RepeatButtonPage>(),
2626
"slider" => Component<ControlPages.BasicInput.SliderPage>(),
2727
"split-button" => Component<ControlPages.BasicInput.SplitButtonPage>(),
28-
"text-field" => Component<ControlPages.BasicInput.TextFieldPage>(),
28+
"text-box" => Component<ControlPages.BasicInput.TextBoxPage>(),
2929
"toggle-button" => Component<ControlPages.BasicInput.ToggleButtonPage>(),
3030
"toggle-switch" => Component<ControlPages.BasicInput.ToggleSwitchPage>(),
3131

samples/apps/demo-script-tool/App/DemoScriptShell.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public override Element Render()
7777
// file watcher fires for a write WE just made, the disk hash equals
7878
// this value and we suppress the reload — otherwise our own debounced
7979
// save round-trips through the watcher, replaces the model with a new
80-
// instance, re-syncs every TextField's local buffer, and resets the
80+
// instance, re-syncs every TextBox's local buffer, and resets the
8181
// user's caret to position 0 mid-keystroke.
8282
var lastSyncedHashRef = UseRef<string?>(null);
8383
var announce = UseAnnounce();

samples/apps/dock-showcase/App.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ private static DockNode BuildInitialLayout()
329329

330330
// ── Editable pane content factories ────────────────────────────────
331331
//
332-
// Each docked pane gets a TextField (or AcceptsReturn=multiline) so
332+
// Each docked pane gets a TextBox (or AcceptsReturn=multiline) so
333333
// we can observe keyboard focus / input routing through the docking
334334
// host. Spec 045 §2.10 + §2.14 invariants we're stressing here:
335-
// • Clicking a TextField inside a pane gives it keyboard focus.
336-
// • Typing into the focused TextField does NOT trigger chord
335+
// • Clicking a TextBox inside a pane gives it keyboard focus.
336+
// • Typing into the focused TextBox does NOT trigger chord
337337
// accelerators (Ctrl+Tab / Ctrl+W must reach the editor when it
338338
// owns focus, not the host's KeyboardAccelerator surface).
339-
// • Tab inside a TextField should advance focus within the pane,
339+
// • Tab inside a TextBox should advance focus within the pane,
340340
// not skip to the next docked group.
341-
// • A drag of the pane preserves the TextField's current value
341+
// • A drag of the pane preserves the TextBox's current value
342342
// (controlled-input pattern through the §2.30 shape-only
343343
// override + Memo-component state slot).
344344
//
@@ -349,10 +349,10 @@ private static Element EditorPane(string banner, string initial) =>
349349
Memo(ctx =>
350350
{
351351
var (text, setText) = ctx.UseState(initial);
352-
// INTENTIONALLY MINIMAL: a single-line controlled TextField,
352+
// INTENTIONALLY MINIMAL: a single-line controlled TextBox,
353353
// no .Set, no AcceptsReturn, no typography modifiers. This
354354
// isolates whether the focus-loss-on-keystroke bug is in
355-
// the controlled-TextField/Memo-state base case or in one
355+
// the controlled-TextBox/Memo-state base case or in one
356356
// of the optional modifiers / multi-line config.
357357
return VStack(6,
358358
TextBlock(banner).SemiBold(),

src/Reactor.Analyzers/AccessibilityAnalyzers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private static bool HasModifierInChain(SyntaxNode node, params string[] modifier
170170

171171
/// <summary>
172172
/// REACTOR_A11Y_003: Form fields need a label for screen readers.
173-
/// Detects <c>TextField(...)</c>, <c>NumberBox(...)</c>, <c>PasswordBox(...)</c>,
173+
/// Detects <c>TextBox(...)</c>, <c>NumberBox(...)</c>, <c>PasswordBox(...)</c>,
174174
/// and <c>AutoSuggestBox(...)</c> factory calls without a <c>header:</c> named argument,
175175
/// <c>.AutomationName()</c>, or <c>.LabeledBy()</c> in the fluent chain.
176176
/// </summary>
@@ -197,7 +197,7 @@ public sealed class FormFieldLabelAnalyzer : DiagnosticAnalyzer
197197
description: Description);
198198

199199
private static readonly ImmutableHashSet<string> FormFieldMethods =
200-
ImmutableHashSet.Create("TextBox", "TextField", "NumberBox", "PasswordBox", "AutoSuggestBox");
200+
ImmutableHashSet.Create("TextBox", "NumberBox", "PasswordBox", "AutoSuggestBox");
201201

202202
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics =>
203203
ImmutableArray.Create(Rule);

0 commit comments

Comments
 (0)