Skip to content

Fix keyboard focus not reaching DataGrid column headers#791

Merged
dipeshmsft merged 2 commits into
microsoft:mainfrom
wnvko-msft:mvenkov/fix-focus-on-column-header-3018981
Jul 6, 2026
Merged

Fix keyboard focus not reaching DataGrid column headers#791
dipeshmsft merged 2 commits into
microsoft:mainfrom
wnvko-msft:mvenkov/fix-focus-on-column-header-3018981

Conversation

@wnvko-msft

@wnvko-msft wnvko-msft commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

WPF Gallery → Collections → DataGrid: while navigating with the keyboard, focus skipped the column headings, so keyboard-only users could not reach them. DataGridColumnHeader is non-focusable by default.

This adds a ColumnHeaderStyle on the sample DataGrid that sets Focusable=True (based on the Fluent default style), so the column headings receive keyboard focus during navigation. The displayed XamlCode is updated to match.

Testing: Navigate to Collections → DataGrid and Tab/arrow into the table - focus now lands on the column headers.

Microsoft Reviewers: Open in CodeFlow

@dipeshmsft dipeshmsft added the Accessibility An issue related to accessibility enhancements or blockers. label Jul 1, 2026
@dipeshmsft

Copy link
Copy Markdown
Member

The change looks good. However, is there a way we can make the focus visual around the header more visible. As of now, it is getting clipped, and the A11y team will push back for this.

image

@himgoyalmicro himgoyalmicro changed the title Fix keyboard focus not reaching DataGrid column headers (3018981) Fix keyboard focus not reaching DataGrid column headers Jul 3, 2026
@wnvko-msft

Copy link
Copy Markdown
Contributor Author

The change looks good. However, is there a way we can make the focus visual around the header more visible. As of now, it is getting clipped, and the A11y team will push back for this.

image

@dipeshmsft
Fixed - the default focus visual drew 3px outside the control and got clipped at the header edges. Added an inset FocusVisualStyle so it's fully visible now.

@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.

Great, this looks better now.

@dipeshmsft dipeshmsft merged commit 9da1171 into microsoft:main Jul 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility An issue related to accessibility enhancements or blockers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants