Skip to content

Fix keyboard focus not scrolling copy buttons into view on Color and Icons pages - #802

Merged
vinnarayana-msft merged 1 commit into
microsoft:mainfrom
mmanolova-msft:fix/3036673-colortile-tab-focus-scroll
Jul 30, 2026
Merged

Fix keyboard focus not scrolling copy buttons into view on Color and Icons pages#802
vinnarayana-msft merged 1 commit into
microsoft:mainfrom
mmanolova-msft:fix/3036673-colortile-tab-focus-scroll

Conversation

@mmanolova-msft

@mmanolova-msft mmanolova-msft commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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 → BringIntoView path. 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 IsFocusScope was safe to remove

It was never needed on these buttons:

Result

  • Tab now scrolls the focused copy button into view on both pages.
  • Copy-to-clipboard continues to work (verified on both pages).

ControlExample's source-code copy buttons are intentionally left unchanged — their tab/scroll behavior is already correct.

Testing

  • Design Guidance → Color: Tab through copy buttons; off-screen buttons scroll into view; brush name still copies.
  • Design Guidance → Icons: same behavior verified; icon text still copies.
  • Build: dotnet build WPFGallery.csproj succeeds (0 errors).
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow

…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 dipeshmsft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, probably this was added while the code got generated.

@vinnarayana-msft
vinnarayana-msft merged commit 0943a45 into microsoft:main Jul 30, 2026
10 checks passed
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.

3 participants