fix(accessibility): declare native status before the browser peer

Refs #6, #7

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-10 20:33:36 -05:00
1 parent fa0df784b3
commit 77dd04da96
4 files changed
+28 -2

No files matched your search

+10
View File
@@ -52,6 +52,16 @@ assertions remain unchanged. Theme commit 0507ca5 is local until this follow-up
117 core tests/100% coverage and zero-warning build/format passed. Real browser proof
of display fitting and theme selection remains pending.
Fitted head fa0df78 passed 25/26 hosted native/UI tests, including the document-theme
choice, but still failed the initial status lookup. The retained fitted screenshot
shows the status line visibly inside the window; fitting fixed clipping, not the
remaining automation problem. Diagnostics encountered an unsupported IsOffscreen
property on a browser peer; reads now use ValueOrDefault. The next change declares
the native status peer before WebView2, retaining Grid.Row=2 and the same visual
layout, to test the embedded-provider traversal boundary. The theme test also checks
actual painted dark/light backgrounds and retains its fixture screenshot. No assertion
is weakened or skipped; proof remains pending.
## Repository and authorization
Public repository: [MarkdownViewr.Windows](https://github.com/KofTwentyTwo/MarkdownViewr.Windows).
+1 -1
View File
@@ -44,7 +44,7 @@
</MenuBarItem>
</MenuBar>
<WebView2 x:Name="DocumentView" Grid.Row="1" Loaded="DocumentView_Loaded" AutomationProperties.Name="Markdown document" />
<TextBlock x:Name="StatusText" Grid.Row="2" Margin="16,8" Text="Starting the document surface..." TextWrapping="Wrap" Foreground="{ThemeResource TextFillColorSecondaryBrush}" AutomationProperties.AutomationId="StatusText" AutomationProperties.Name="{Binding Text, ElementName=StatusText}" AutomationProperties.AccessibilityView="Content" AutomationProperties.LiveSetting="Polite" />
<WebView2 x:Name="DocumentView" Grid.Row="1" Loaded="DocumentView_Loaded" AutomationProperties.Name="Markdown document" />
</Grid>
</Window>
@@ -103,7 +103,7 @@ public sealed class AppSession : IDisposable
string name = Guid.NewGuid().ToString("N");
MainWindow.CaptureToFile(Path.Combine(directory, name + ".png"));
string tree = string.Join(Environment.NewLine, MainWindow.FindAllDescendants().Take(200).Select(element =>
$"Id={element.Properties.AutomationId.ValueOrDefault}; Name={element.Properties.Name.ValueOrDefault}; Type={element.Properties.ControlType.ValueOrDefault}; Bounds={element.BoundingRectangle}; Offscreen={element.IsOffscreen}"));
$"Id={element.Properties.AutomationId.ValueOrDefault}; Name={element.Properties.Name.ValueOrDefault}; Type={element.Properties.ControlType.ValueOrDefault}; Bounds={element.Properties.BoundingRectangle.ValueOrDefault}; Offscreen={element.Properties.IsOffscreen.ValueOrDefault}"));
File.WriteAllText(Path.Combine(directory, name + ".log"), tree);
return tree;
}
@@ -95,12 +95,15 @@ public class AppTests
{
using var session = new AppSession(document: "# Theme acceptance");
session.WaitFor(() => session.FindInApp(cf => cf.ByName("Theme acceptance")), "the document heading", TimeSpan.FromSeconds(30));
WaitForDocumentColor(session, System.Drawing.Color.FromArgb(30, 30, 46));
session.InvokeMenuItem("View", "DocumentThemesMenu");
session.ClickElement("DocumentTheme:GitHub Light");
session.WaitFor(
() => session.ReadSettings().Contains("\"DocumentTheme\": \"GitHub Light\"", StringComparison.Ordinal) ? session.MainWindow : null,
"the selected document theme to be saved");
session.WaitFor(() => session.FindInApp(cf => cf.ByName("Theme acceptance")), "the document after its theme changes");
WaitForDocumentColor(session, System.Drawing.Color.White);
_output.WriteLine(session.DescribeDocumentStatus());
Assert.DoesNotContain("\"Theme\": \"Light\"", session.ReadSettings(), StringComparison.Ordinal);
}
@@ -251,6 +254,19 @@ public class AppTests
/// <summary>Waits for the actual painted document palette rather than just a saved preference or old heading.</summary>
private static void WaitForDocumentColor(AppSession session, System.Drawing.Color expected)
{
session.WaitFor(
() =>
{
using System.Drawing.Bitmap image = session.MainWindow.Capture();
return image.GetPixel(image.Width / 2, image.Height / 2).ToArgb() == expected.ToArgb() ? session.MainWindow : null;
},
"the rendered document background " + expected);
}
/// <summary>Finds the browser's actual scroll provider, which is separate from the native window.</summary>
private static AutomationElement FindDocumentScroller(AppSession session)
{