Skip to content

Conversation

@weiyuanyue
Copy link
Contributor

@weiyuanyue weiyuanyue commented Nov 12, 2025

ADO 58931060

Summary

Pressing Tab from the “Download model” button inside the “Select a model to use for this sample” dialog caused the entire app to close. The crash occurred whenever focus moved into the ItemsView that rendered selected models. Replacing ItemsView with ItemsRepeater removes the crash and restores proper keyboard focus order.

User Impact (A11y)

Keyboard-only users (WCAG 2.1.1 Keyboard) could not proceed past the dialog: a Tab keystroke closed the app. This blocked model selection and sample execution. The fix removes the unexpected termination and preserves linear focus navigation, improving accessibility compliance and usability.

Root Cause (Likely)

When focus moves from the “Download model” button to the ItemsView, the framework requests a UI Automation interface (COM) not implemented by the generated peer chain. The sequence triggers System.InvalidCastException with HRESULT 0x80004002 (E_NOINTERFACE: “No such interface supported”). The ItemsView + ItemContainer usage inside this overlay is sufficient to reproduce the failure; substituting ItemsRepeater immediately removes the exception. This strongly suggests an upstream ItemsView focus navigation bug.
截屏2025-11-13 00 59 31

Why ItemsRepeater Instead of ItemsView Here

  • Contextual needs are minimal: horizontal display of a small set of selected models, each updating as the user chooses a model type.

  • ItemsView advantages (not needed here): built‑in selection state, item invoked event, auto focus/selection patterns.

  • ItemsRepeater advantages for this case:

    1. Simpler container (no extra ItemContainer layer).
    2. No implicit selection peer logic, avoiding the failing interface query.
    3. Lower overhead and predictable focus behavior.
    4. Easier to customize visuals and manual selection tracking.

Trade-off: We implement a tiny selection index ourselves (few lines). No lost functionality for this dialog.

Validation

  • Manual keyboard traversal: Tab / Shift+Tab no longer closes app.
  • Focus enters and leaves the model list without exceptions.
  • Model selection still updates Save button enable state.
  • No compile-time errors introduced (C# file builds clean).
  • Visual regression: layout and styling preserved (same padding, border, colors).

Risk Assessment

Low. The replaced control is isolated to the dialog. ItemsRepeater is stable and widely used. The only behavior changed is internal selection plumbing (now explicit rather than implicit). If future upstream ItemsView bug fix appears, we can revert with limited impact.

@weiyuanyue weiyuanyue changed the title [Fix][A11y] [A11y]Fix: Prevent Tab crash in model picker: replace ItemsView with ItemsRepeater Nov 12, 2025
@weiyuanyue weiyuanyue marked this pull request as ready for review November 12, 2025 17:02
@weiyuanyue weiyuanyue merged commit aaa8bd1 into main Nov 13, 2025
8 checks passed
@weiyuanyue weiyuanyue deleted the milly/a11y3fix branch November 13, 2025 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants