Repository navigation
Don't toggle a SettingsExpander when typing Space in a header TextBox - #21021
Merged
Dustin L. Howett (DHowett) merged 1 commit intoDec 3, 2026
Merged
Conversation
The expander's header ToggleButton treated Space/Enter bubbling up from controls hosted in the header (e.g. the profile Name box) as clicks, toggling the expander and swallowing the typed character. Use a ToggleButton subclass that only handles keys aimed at itself.
Dustin L. Howett (DHowett)
approved these changes
Dec 3, 2026
Dustin L. Howett (DHowett)
marked this pull request as ready for review
December 3, 2026 22:00
Dustin L. Howett (DHowett)
deleted the
crutkas-fix-expander-header-space-toggle
branch
December 3, 2026 22:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
7ddaaec103494d9255e8b53665397416cc734312↑ Same result from a scripted UIA check; key handling for the header itself is unchanged.
↓ Background image path box and the "Add a new profile" split button in a header weren't checked by hand.
↓ No automated test; gamepad and Narrator not checked.
↑ Scripted check reproduced the toggle on the unfixed build and not on the fixed one.
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.Contentlives 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 whenOriginalSourceis 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.PR Checklist