patternfly / patternfly/react-data-view

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

オープン
#513 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
4
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

DataViewFilters の実装から始め、既存の「Clear all filters」の動作をたどり、アクティブな属性がどのように選択されるかも確認します。クリア時に常に最初の属性を選択するべきか、defaultActiveFilterId prop をサポートするべきかを判断し、その後、フィルターをクリアしたときに dropdown が期待どおりにリセットされることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react, typescript
領域
frontend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。