Skip to content

Commit a54e2ef

Browse files
Rename boolean modifiers to WinUI names (#268)
Rename all boolean-style fluent modifiers to align with WinUI property names per reviewer feedback: - Visible -> IsVisible - Disabled -> IsEnabled (inverted) - Selectable -> IsTextSelectionEnabled - ReadOnly -> IsReadOnly (TextField, RatingControl) - Editable -> IsEditable - Closable -> IsClosable - Active -> IsActive - DisabledFocusable -> IsDisabledFocusable - LightDismiss -> IsLightDismissEnabled - IsAddButtonVisible/ShowAddButton -> IsAddTabButtonVisible Old names kept as [Obsolete] shims. All first-party code migrated. API surface files updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e35e946 commit a54e2ef

77 files changed

Lines changed: 338 additions & 201 deletions

File tree

Some content is hidden

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

SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ class App : Component
476476
}
477477

478478
static Element NavBtn(string label, string current, Action<string> set) =>
479-
Button(label, () => set(label)).Disabled(label == current);
479+
Button(label, () => set(label)).IsEnabled(!(label == current));
480480
}
481481
```
482482

docs/_pipeline/ai-author-skill.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ case (no deps); `Memo(ctx => …, deps)` to also re-render when any dep changes;
702702
`.Background(color|ThemeRef)`, `.Foreground(color|ThemeRef)`,
703703
`.CornerRadius(n)`, `.WithBorder(color|ThemeRef, thickness?)`,
704704
`.HAlign(alignment)`, `.VAlign(alignment)`,
705-
`.Disabled(bool)`, `.Visible(bool)`, `.WithKey(string)`,
705+
`.IsEnabled(!bool)`, `.IsVisible(bool)`, `.WithKey(string)`,
706706
`.Flex(grow?, shrink?, basis?)`, `.ToolTip(string)`,
707707
`.FocusTrap(FocusTrapHandle)`,
708708
`.Set(control => { /* raw WinUI access */ })`

docs/_pipeline/apps/accessibility/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public override Element Render()
8383
CheckBox(agree, setAgree, label: "I accept the terms")
8484
.TabIndex(3),
8585
Button("Register", () => { })
86-
.Disabled(!valid).TabIndex(4).AccessKey("R")
86+
.IsEnabled(valid).TabIndex(4).AccessKey("R")
8787
).Landmark(AutomationLandmarkType.Form).Padding(24);
8888
}
8989
}

docs/_pipeline/apps/forms/App.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ public override Element Render()
119119
// commit-on-keystroke, so validation reacts as the user types.
120120
NumberBox(age, setAge, header: "Age").Immediate(),
121121

122-
// .DisabledFocusable() keeps the button tab-reachable and
122+
// .IsDisabledFocusable() keeps the button tab-reachable and
123123
// visually dimmed while preventing invocation. Pattern mirrors
124124
// Fluent UI's `disabledFocusable` and ARIA `aria-disabled`.
125125
Button("Submit", () => { /* submit */ })
126-
.DisabledFocusable(!formValid)
126+
.IsDisabledFocusable(!formValid)
127127
.Margin(0, 8, 0, 0)
128128
).Padding(24);
129129
}
@@ -162,7 +162,7 @@ public override Element Render()
162162
{
163163
ctx.MarkAllTouched();
164164
if (ctx.IsValid()) setSubmitted(true);
165-
}).Disabled(submitted),
165+
}).IsEnabled(!submitted),
166166
When(submitted, () =>
167167
TextBlock("Registration successful!")
168168
.Foreground(Theme.SystemSuccess).SemiBold())

docs/_pipeline/apps/navigation/App.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override Element Render()
3838
Button("Settings", () => nav.Navigate(Route.Settings)),
3939
Button("Profile", () => nav.Navigate(Route.Profile)),
4040
Button("Back", () => nav.GoBack())
41-
.Disabled(!nav.CanGoBack)
41+
.IsEnabled(nav.CanGoBack)
4242
),
4343
NavigationHost(nav, route => route switch
4444
{
@@ -101,9 +101,9 @@ public override Element Render()
101101
Button("Reset", () =>
102102
nav.Reset(Route.Home)),
103103
Button("Back", () => nav.GoBack())
104-
.Disabled(!nav.CanGoBack),
104+
.IsEnabled(nav.CanGoBack),
105105
Button("Forward", () => nav.GoForward())
106-
.Disabled(!nav.CanGoForward)
106+
.IsEnabled(nav.CanGoForward)
107107
),
108108
NavigationHost(nav, route =>
109109
TextBlock($"Page: {route}")
@@ -158,7 +158,7 @@ public override Element Render()
158158
Button("Settings", () => nav.Navigate(Route.Settings)),
159159
Button("Profile", () => nav.Navigate(Route.Profile)),
160160
Button("Back", () => nav.GoBack())
161-
.Disabled(!nav.CanGoBack)
161+
.IsEnabled(nav.CanGoBack)
162162
),
163163
NavigationHost(nav, route => route switch
164164
{
@@ -256,7 +256,7 @@ public override Element Render()
256256
{
257257
if (savedState is not null)
258258
nav.SetState(savedState);
259-
}).Disabled(savedState is null)
259+
}).IsEnabled(!(savedState is null))
260260
),
261261
TextBlock($"Current: {nav.CurrentRoute}"),
262262
TextBlock($"Saved: {savedState?[..Math.Min(50, savedState?.Length ?? 0)] ?? "(none)"}")
@@ -322,7 +322,7 @@ public override Element Render()
322322
Button("Home", () => nav.Navigate(Route.Home)),
323323
Button("Settings", () => nav.Navigate(Route.Settings)),
324324
Button("Back", () => nav.GoBack())
325-
.Disabled(!nav.CanGoBack)
325+
.IsEnabled(nav.CanGoBack)
326326
),
327327
NavigationHost(nav, route => route switch
328328
{

docs/_pipeline/apps/todo-app/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public override Element Render()
3535
updateItems(list => [.. list, new TodoItem(newText.Trim(), false)]);
3636
setNewText("");
3737
}
38-
}).Disabled(string.IsNullOrWhiteSpace(newText))
38+
}).IsEnabled(!(string.IsNullOrWhiteSpace(newText)))
3939
),
4040

4141
// Item list

docs/_pipeline/apps/xaml-developers/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override Element Render()
4949
TextField(email, setEmail, header: "Email"),
5050
CheckBox(wantsUpdates, setWantsUpdates, label: "Email me updates"),
5151
HStack(8,
52-
Button("Save", () => { }).Disabled(!canSave),
52+
Button("Save", () => { }).IsEnabled(canSave),
5353
TextBlock(canSave ? "Ready to save" : "Complete all required fields")
5454
.Opacity(0.7)
5555
)

docs/_pipeline/templates/forms.md.dt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Reactor offers two opt-in fixes for this. They compose:
138138

139139
![Keep submit reachable](screenshot://forms/keep-submit-reachable)
140140

141-
**`.DisabledFocusable(bool)` on Button** keeps the button keyboard-focusable
141+
**`.IsDisabledFocusable(bool)` on Button** keeps the button keyboard-focusable
142142
and tab-reachable while presenting it as disabled (dimmed; the click is
143143
suppressed). Mirrors Fluent UI React's `disabledFocusable` and ARIA's
144144
`aria-disabled`. Use it for any Submit gated on validation, busy state, or
@@ -152,14 +152,14 @@ the right choice when an intermediate value would be expensive or surprising
152152
(snapping `2.50` to `2.5` mid-edit). Apply when validation gates UI state
153153
and you want it to feel live.
154154

155-
Use `.DisabledFocusable()` whenever a button is conditionally disabled in a
155+
Use `.IsDisabledFocusable()` whenever a button is conditionally disabled in a
156156
form — even if you've also applied `.Immediate()` to every commit-on-blur
157157
input. The two cover different failure modes: `.Immediate()` keeps validity
158-
in sync with typing; `.DisabledFocusable()` keeps the button discoverable
158+
in sync with typing; `.IsDisabledFocusable()` keeps the button discoverable
159159
when validity is gated on async checks, required-but-untouched fields,
160160
cross-field rules, or any derived condition that can't be made instantaneous.
161161

162-
> **Where not to use `.DisabledFocusable()`:** only buttons. For data-entry
162+
> **Where not to use `.IsDisabledFocusable()`:** only buttons. For data-entry
163163
> controls (`TextField`, `NumberBox`, `CheckBox`, etc.), `IsEnabled=false`
164164
> usually means "this field isn't part of your current task" (cascading
165165
> from another input), and tab-skipping is the correct UX. Use

docs/guide/accessibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class AccessibleFormDemo : Component
156156
CheckBox(agree, setAgree, label: "I accept the terms")
157157
.TabIndex(3),
158158
Button("Register", () => { })
159-
.Disabled(!valid).TabIndex(4).AccessKey("R")
159+
.IsEnabled(valid).TabIndex(4).AccessKey("R")
160160
).Landmark(AutomationLandmarkType.Form).Padding(24);
161161
}
162162
}

docs/guide/forms.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ class KeepSubmitReachableDemo : Component
246246
// commit-on-keystroke, so validation reacts as the user types.
247247
NumberBox(age, setAge, header: "Age").Immediate(),
248248

249-
// .DisabledFocusable() keeps the button tab-reachable and
249+
// .IsDisabledFocusable() keeps the button tab-reachable and
250250
// visually dimmed while preventing invocation. Pattern mirrors
251251
// Fluent UI's `disabledFocusable` and ARIA `aria-disabled`.
252252
Button("Submit", () => { /* submit */ })
253-
.DisabledFocusable(!formValid)
253+
.IsDisabledFocusable(!formValid)
254254
.Margin(0, 8, 0, 0)
255255
).Padding(24);
256256
}
@@ -259,7 +259,7 @@ class KeepSubmitReachableDemo : Component
259259

260260
![Keep submit reachable](images/forms/keep-submit-reachable.png)
261261

262-
**`.DisabledFocusable(bool)` on Button** keeps the button keyboard-focusable
262+
**`.IsDisabledFocusable(bool)` on Button** keeps the button keyboard-focusable
263263
and tab-reachable while presenting it as disabled (dimmed; the click is
264264
suppressed). Mirrors Fluent UI React's `disabledFocusable` and ARIA's
265265
`aria-disabled`. Use it for any Submit gated on validation, busy state, or
@@ -273,14 +273,14 @@ the right choice when an intermediate value would be expensive or surprising
273273
(snapping `2.50` to `2.5` mid-edit). Apply when validation gates UI state
274274
and you want it to feel live.
275275

276-
Use `.DisabledFocusable()` whenever a button is conditionally disabled in a
276+
Use `.IsDisabledFocusable()` whenever a button is conditionally disabled in a
277277
form — even if you've also applied `.Immediate()` to every commit-on-blur
278278
input. The two cover different failure modes: `.Immediate()` keeps validity
279-
in sync with typing; `.DisabledFocusable()` keeps the button discoverable
279+
in sync with typing; `.IsDisabledFocusable()` keeps the button discoverable
280280
when validity is gated on async checks, required-but-untouched fields,
281281
cross-field rules, or any derived condition that can't be made instantaneous.
282282

283-
> **Where not to use `.DisabledFocusable()`:** only buttons. For data-entry
283+
> **Where not to use `.IsDisabledFocusable()`:** only buttons. For data-entry
284284
> controls (`TextField`, `NumberBox`, `CheckBox`, etc.), `IsEnabled=false`
285285
> usually means "this field isn't part of your current task" (cascading
286286
> from another input), and tab-skipping is the correct UX. Use
@@ -324,7 +324,7 @@ class ValidationContextDemo : Component
324324
{
325325
ctx.MarkAllTouched();
326326
if (ctx.IsValid()) setSubmitted(true);
327-
}).Disabled(submitted),
327+
}).IsEnabled(!submitted),
328328
When(submitted, () =>
329329
TextBlock("Registration successful!")
330330
.Foreground(Theme.SystemSuccess).SemiBold())

0 commit comments

Comments
 (0)