patternfly / patternfly/react-data-view

DataViewFilters dropdown: Reset active attribute to first item after the filters are cleared

Open
#513 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Hi team, we’re using DataView + DataViewToolbar + DataViewFilters. When a user clicks “Clear all filters”, we want the attribute dropdown (in DataViewFilters) to reset to the first filter (our Name/URL) instead of staying on the last interacted attribute.

Right now, we’re nudging React to remount the first child by bumping a key on our Name/URL filter after clear. This works but is fragile/hacky.

Current Behavior

https://github.com/user-attachments/assets/262ec720-7d8e-4012-9908-5b8cc5a7ac10

Expected Behavior

https://github.com/user-attachments/assets/875101bd-bd92-4011-bf60-5f328238d0f8

Our Proposal

We have a couple of ideas on how to make this work more smoothly for everyone. We'd love to hear your thoughts on either of these solutions:

  • Make it the default. We think it would be great if DataViewFilters simply reset to the first attribute whenever filters are cleared. It’s what most users would expect, and it would save a lot of people from having to implement their own workarounds.

  • Introduce a new prop. What if we added an optional prop like defaultActiveFilterId? This would give developers the flexibility to explicitly set the default attribute, both on the initial load and after filters are cleared.

Thanks so much for considering our suggestions!


Jira Issue: PF-2719

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the DataViewFilters implementation and trace the existing “Clear all filters” behavior, including how the active attribute is selected. Decide whether clearing should always select the first attribute or support a defaultActiveFilterId prop, then verify that the dropdown resets as expected after filters are cleared.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.