Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MudDataGrid: Focus selected filter when opening simple filter panel#13249

Merged
danielchalmers merged 5 commits into
MudBlazor:devfrom
Jengas2015:feature/add-data-grid-filter-focus
Jun 2, 2026
Merged

MudDataGrid: Focus selected filter when opening simple filter panel#13249
danielchalmers merged 5 commits into
MudBlazor:devfrom
Jengas2015:feature/add-data-grid-filter-focus

Conversation

@Jengas2015

Copy link
Copy Markdown
Contributor

Description

  • When a user clicks into a column filter or selects it via keyboard commands, the focus automatically adjusts to the filter popover.
  • Previously, selecting a column filter would not change the focus and tabbing over would only select the background items.

TO TEST:

  • Navigate to Mud Data Grid, find a column filter, use keyboard navigation/tabs to select items within the popover.
  • Make sure the focus adjusts to the popover correctly.

This is the before:
FilterFocusBefore

This is the after:
FilterFocusAfter

Checklist:

  • I've read the contribution guidelines
  • My code follows the style of this project
  • I've added or updated relevant unit tests

@mudbot mudbot Bot added accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) bug Unexpected behavior or functionality not working as intended labels May 27, 2026
@mudbot mudbot Bot changed the title DataGrid: Focus selected filter when opening simple filter panel MudDataGrid: Focus selected filter when opening simple filter panel May 27, 2026
@danielchalmers danielchalmers added enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library and removed bug Unexpected behavior or functionality not working as intended labels May 31, 2026
/// Opens the filter panel.
/// </summary>
public void OpenFilters()
public void OpenFilters(Guid? filterDefinitionIdToFocus = null)

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.

Changing the public OpenFilters() method signature to OpenFilters(Guid? = null) removes the zero-argument method at the binary level, so existing compiled consumers can hit MissingMethodException. We should keep public void OpenFilters() and add a separate internal/helper overload for focusing a specific filter.

Comment thread src/MudBlazor.UnitTests/Components/DataGridTests.cs Outdated
@mudbot mudbot Bot added needs: changes A maintainer has asked for further modifications to be made to this pull request needs: tests A maintainer has explicitly asked for test cases to be added labels May 31, 2026
@mudbot mudbot Bot removed needs: changes A maintainer has asked for further modifications to be made to this pull request needs: tests A maintainer has explicitly asked for test cases to be added labels Jun 2, 2026
Keep one regression test for the user-facing header filter path instead of asserting the internal OpenFilters overload and default fallback separately.

The remaining test verifies that opening an existing Age column filter marks only the matching filter field for autofocus. This keeps coverage close to the reported behavior while avoiding brittle bUnit assertions around actual DOM focus plumbing, which does not translate cleanly in this component.

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants