patternfly / patternfly/react-data-view

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

Đang mở
#513 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
TypeScript
Star
4
Fork
21
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ phần triển khai DataViewFilters và lần theo hành vi “Clear all filters” hiện có, bao gồm cả cách thuộc tính đang hoạt động được chọn. Xác định xem việc xóa có luôn phải chọn thuộc tính đầu tiên hay hỗ trợ một prop defaultActiveFilterId, sau đó kiểm tra rằng dropdown được đặt lại như mong đợi sau khi các bộ lọc được xóa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
react, typescript
Lĩnh vực
frontend
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.