← Back to Pull requests

Don't toggle a SettingsExpander when typing Space in a header TextBox #21021

Closed
unknown closed this pull request without merging on Dec 03, 2026 22:01 UTC
View on GitHub
unknown unknown commented on Dec 03, 2026 21:29 UTC
Author

If you typed in a space bar into the name field. the expander would flip vs putting in a space. This now allows a space to be put in.

If the expander is in focus and space is hit, it will expand / collapse still.

I manually validated put typing and expanding work now.

<img width="1101" height="413" alt="image" src="https://github.com/user-attachments/assets/3a51eb11-289a-4272-bba5-db71e40a2bf2" />

<!-- copilot-assessment:v1 -->

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 7ddaaec103494d9255e8b53665397416cc734312

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 8.5/10 | ↑ Verified by hand in Terminal Dev with a real keyboard: Space types, no toggle; header Space still toggles.<br>↑ Same result from a scripted UIA check; key handling for the header itself is unchanged.<br>↓ Background image path box and the "Add a new profile" split button in a header weren't checked by hand.<br>↓ No automated test; gamepad and Narrator not checked. |
| Diagnosis confidence | 9.5/10 | ↑ ButtonBase key handling acts on any Space/Enter that bubbles to it and marks KeyDown handled.<br>↑ Scripted check reproduced the toggle on the unfixed build and not on the fixed one. |
| Evidence fit | 9.5/10 | ↑ Exactly the reported symptom (Space in profile Name toggles the expander), reproduced and fixed on a Dev build. |
<!-- /copilot-assessment -->

Summary of the Pull Request


Typing Space in a TextBox that sits in a SettingsExpander header (profile Name, background image path) toggled the expander instead of typing the space.

References and Relevant Issues


Regressed by #20232 (background image path moved into the expander header) and #20336 (profile Name moved into an expander header).

Detailed Description of the Pull Request / Additional comments


The expander header is a ToggleButton, and everything in SettingsExpander.Content lives inside it. ButtonBase acts on any Space/Enter/GamepadA that bubbles up to it, not just keys aimed at itself, and marks the KeyDown handled, so the TextBox never gets the character.

The template's header ToggleButton is now SettingsExpanderHeaderButton, a ToggleButton subclass that only passes key events to the base class when OriginalSource is the button itself. Keys from hosted controls stay unhandled. Space/Enter on the header itself still toggles.

Validation Steps Performed


  • msbuild OpenConsole.slnx /p:Configuration=Debug /p:Platform=ARM64 "/t:Terminal\CascadiaPackage" /m: passed, deployed as Terminal Dev.

  • By hand in Terminal Dev: Space in Profiles > Windows PowerShell > Name types a space and doesn't toggle. Space on the header row still toggles.

  • Scripted the same check with UIA plus posted keys against both builds. Without the fix, Space/Enter in the Name box toggled the expander. With it they don't, and Space on the focused header still toggles.

  • No automated test added.
  • PR Checklist


  • Closes #xxx

  • Tests added/passed

  • Documentation updated

  • - If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated (if necessary)
  • Diff: 399 lines (+299 / -100) across 4 files Reviewer: DHowett Review duration: 31m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 399 lines diff across 4 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.358
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #21021"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.2% (MEDIUM) · Higher = larger blast radius
    48.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.1% · Safe to merge
    19.1%