patternfly / patternfly/react-data-view

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

Offen
#513 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
4
Forks
21
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei der Implementierung von DataViewFilters und verfolge das vorhandene Verhalten von „Clear all filters“, einschließlich der Auswahl des aktiven Attributs. Entscheide, ob beim Löschen immer das erste Attribut ausgewählt werden sollte oder eine defaultActiveFilterId-Prop unterstützt werden sollte, und überprüfe anschließend, dass das Dropdown nach dem Löschen der Filter wie erwartet zurückgesetzt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
react, typescript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.