fix(ui): #372 — Options tabs no longer blank; UiTemplateListBox viewport fills its ListBox

ROOT CAUSE (proven, not guessed): the lazily-created row viewport was
constructed 0x0 with Left|Top|Right|Bottom fill-anchors. Its first
ApplyAnchor captured mR = parentW - (0+0) = parentW, so
ComputeAnchoredRect's l&&r branch (w = parentW - mR - mL) kept it 0x0
forever. A 0-tall viewport makes UiScrollablePanel.LayoutScrollableChildren
cull every row, so Character/Chat/Config rendered blank while Gameplay
(no viewport — authored static children sized at Build) worked. This is
the exact Gameplay-vs-rest split the user's first connected gate found.

FIX: seed the viewport to the ListBox's current extent at creation, so the
fill-anchor baseline is mR = parentW - parentW = 0 and the viewport tracks
the parent. The ListBox is a static dat child sized at Build, so its extent
is authored by the time the viewport is lazily created during Bind.
Dormancy preserved — the viewport is still created only on the first row.

Reproduced RED then GREEN by UiTemplateListBoxViewportTests (viewport fills;
rows stay visible after the anchor+cull layout pass) — the layout path the
whole fixture conformance suite structurally never drove, which is why
every OP2-OP6 test was green over a live-only blank-tab failure. Full
Release suite 13,131 / 4 skips / 0 failed.

Still owed (NOT fixed here, no evidence yet): the 'only Exit Game worked'
Gameplay-buttons observation needs a re-gate (two buttons are correctly
INERT; the other four have dialog/chat effects that may have gone
unnoticed); and the 13 ID_ChatOption_TextFilter_* labels fail to resolve
(blank captions, behaviour unaffected). See #372.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-11 09:58:42 +02:00
parent c3ed32fb5a
commit 057d8cd703
3 changed files with 138 additions and 1 deletions

View file

@ -144,16 +144,37 @@ public sealed class UiTemplateListBox : UiDatElement
/// <summary>Retail ListBox rows never come from static dat children — see class doc.</summary>
public override bool ConsumesDatChildren => true;
/// <summary>The lazily-created row viewport, or null before the first row is added.
/// Exposed for #372's regression test (the viewport must fill this ListBox, not
/// collapse to 0×0).</summary>
internal UiScrollablePanel? ViewportForTest => _viewport;
private UiScrollablePanel Viewport
{
get
{
if (_viewport is null)
{
// #372: the viewport MUST start filling this ListBox. It is created
// lazily (post-Build, during a page controller's Bind), so it misses
// the Build-time sizing that authored static children get. With
// Left|Top|Right|Bottom fill-anchors but a 0×0 initial rect, the
// anchor system captures a degenerate baseline (mR = parentW - (0+0)
// = parentW) and ComputeAnchoredRect then keeps it 0×0 forever
// (w = parentW - mR - mL = 0) — a 0-tall viewport makes
// UiScrollablePanel.LayoutScrollableChildren cull every row, so every
// ListBox-backed Options tab renders BLANK (Gameplay, which has no
// viewport, was the only tab that worked). Seeding the viewport to
// this ListBox's current size makes the fill-anchor baseline correct
// (mR = parentW - (0 + parentW) = 0) and self-maintaining as the
// ListBox re-anchors each frame. The ListBox is a static dat child
// sized at Build, so its extent is already authored here.
_viewport = new UiScrollablePanel
{
Anchors = AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Right | AnchorEdges.Bottom,
LineHeight = _pendingLineHeight,
Width = Width,
Height = Height,
};
base.AddChild(_viewport);
}