fix(navigation): resolve the heading from clicked native content

WinUI ItemClick supplies the TextBlock content rather than the ListViewItem. Attach the numeric heading identity to both native elements and accept the tagged clicked content. The original physical repeat-navigation regression reproduces the mismatch; no source scroll mapping or assertion changes.

Refs #10, #11.

Co-Authored-By: Codex (GPT-6) <noreply@openai.com>
Signed-off-by: James Maes <jmaes@dmdbrands.com>
This commit is contained in:
James MaesandCodex committed 2026-10-11 02:26:35 -05:00
1 parent dcddefb9c7
commit 690be072d9
2 files changed
+22 -3

No files matched your search

+19
View File
@@ -11,6 +11,25 @@ Owner authorized signed/DCO commits, pushes, repository configuration and ticket
No merges, tags/releases or new Azure attempts. Human review acknowledgement remains
required. Local desktop reservation is unanswered; hosted runner UI tests are authorized.
## Confirmed WinUI clicked-content identity fix — 2026-10-11
Signed dcddefb pushed. Focused source 38121148429/job 114415967219 fails
at the added real browser assertion after repeat activation. The trace proves
ItemClick dispatches TextBlock twice (initial and repeated clicks), refreshing=False,
index=-1. Owned physical pointer is over the expected OutlineHeading:2. No reader
geometry change follows the repeated click. Thus content/container mismatch,
not source feedback or missing native event, explains the repeat-navigation bug.
Evidence: artifacts/source-activation-boundary-38121148429.log.
Attach the existing numeric DocumentHeading tag to the native TextBlock as well
as its ListViewItem; ItemClick accepts the tagged FrameworkElement. No title
lookup, arbitrary source command, extra state or changed scroll mapping.
Keep keyboard SelectionChanged and the actual browser/source/wheel regression.
Retain opted-in trace until original/full acceptance, then remove temporary probes.
The focused original red case is retained. Supersede remaining dcddefb diagnostic
CI with this confirmed fix; cancelled predecessor jobs are not acceptance proof.
Require complete fixed-head native/published/stable/dev results before cleanup.
## Activation boundary trace after physical reproduction — 2026-10-11
016c745 focused source 38120650945/job 114414500506 still fails at the
@@ -74,7 +74,7 @@ public sealed partial class MainWindow
{
foreach(Core.Documents.DocumentHeading heading in _outline.Headings.Where(heading => heading.Level <= _settings.OutlineDepth))
{
var label = new TextBlock { Text = heading.Title, TextWrapping = TextWrapping.Wrap, MaxLines = 2, Margin = new Thickness((heading.Level - 1) * 12, 0, 0, 0) };
var label = new TextBlock { Tag = heading, Text = heading.Title, TextWrapping = TextWrapping.Wrap, MaxLines = 2, Margin = new Thickness((heading.Level - 1) * 12, 0, 0, 0) };
var item = new ListViewItem { Content = label, Tag = heading };
Microsoft.UI.Xaml.Automation.AutomationProperties.SetAutomationId(item, "OutlineHeading:" + heading.Index.ToString(System.Globalization.CultureInfo.InvariantCulture));
OutlineList.Items.Add(item);
@@ -108,10 +108,10 @@ public sealed partial class MainWindow
{
if(string.Equals(Environment.GetEnvironmentVariable("MARKDOWNVIEWR_INPUT_TRACE"), "1", StringComparison.Ordinal))
{
int index = (args.ClickedItem as ListViewItem)?.Tag is Core.Documents.DocumentHeading clicked ? clicked.Index : -1;
int index = (args.ClickedItem as FrameworkElement)?.Tag is Core.Documents.DocumentHeading clicked ? clicked.Index : -1;
App.Log.Info($"[DEBUG-outline-activation] clicked type={args.ClickedItem?.GetType().Name}; refreshing={_refreshingOutline}; index={index}.");
}
if(!_refreshingOutline && args.ClickedItem is ListViewItem { Tag: Core.Documents.DocumentHeading heading })
if(!_refreshingOutline && args.ClickedItem is FrameworkElement { Tag: Core.Documents.DocumentHeading heading })
{
await _browser.JumpToHeadingAsync(heading.Index);
}