Fix keyboard focus not scrolling copy buttons into view on Color and Icons pages - #802
Merged
vinnarayana-msft merged 1 commit intoJul 30, 2026
Conversation
…Icons pages (AB#3036673) Remove FocusManager.IsFocusScope="True" from the copy buttons in ColorTile (Design Guidance -> Color) and IconDataField (Design Guidance -> Icons). The focus scope split logical focus from keyboard focus, so tabbing to a copy button that was scrolled out of view did not raise the framework's IsKeyboardFocused -> BringIntoView, leaving the newly focused button invisible (a WCAG 2.4.3 / 2.4.7 focus-order/focus-visible issue). IsFocusScope was never needed on these buttons: - ColorTile routes ApplicationCommands.Copy via an explicit CommandTarget plus a class CommandBinding, so command routing is focus-independent. (It was added in microsoft#564 as plumbing for a target-less Copy command and made redundant by the explicit CommandTarget added in microsoft#583.) - IconDataField copies via a Click handler (CopyButton_Click), which does not depend on focus at all. With the focus scope removed, Tab now scrolls the focused copy button into view on both pages, and copy-to-clipboard continues to work. ControlExample's source-code copy buttons are intentionally left unchanged; their tab/scroll behavior is already correct. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 45ee703e-394b-4bdc-a77b-94f2933a5a6d
dipeshmsft
approved these changes
Jul 27, 2026
dipeshmsft
left a comment
Member
There was a problem hiding this comment.
LGTM, probably this was added while the code got generated.
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.
Summary
Removes
FocusManager.IsFocusScope="True"from the copy buttons in ColorTile (Design Guidance → Color) and IconDataField (Design Guidance → Icons).The stray focus scope split logical focus from keyboard focus, so tabbing to a copy button that was scrolled out of view did not raise the framework's
IsKeyboardFocused → BringIntoViewpath. The button received focus but stayed off-screen — a WCAG 2.4.3 / 2.4.7 (focus order / focus visible) issue. Work item: AB#3036673.Why
IsFocusScopewas safe to removeIt was never needed on these buttons:
ApplicationCommands.Copyvia an explicitCommandTarget+ a classCommandBinding, so command routing is focus-independent.IsFocusScopewas originally added in Adding CopyToClipboard functionality in Colors page #564 as plumbing for a target-less Copy command, and made redundant by the explicitCommandTargetadded in Fixed Copy command target not being found after multiple registrations #583 — it was simply never cleaned up.Clickhandler (CopyButton_Click), which does not depend on focus at all.Result
ControlExample's source-code copy buttons are intentionally left unchanged — their tab/scroll behavior is already correct.Testing
dotnet build WPFGallery.csprojsucceeds (0 errors).Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow