angular / angular/components

bug(MatRipple): MatRipple can not be disabled for child components

Đang mở
#29,133 4 bình luận 4 reaction 0 người được giao Xem trên GitHub
area: material/core P4
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

14

### Description

I once opened this issue (https://github.com/angular/components/issues/26656) and now coming back with another real-world-issue, that can't be solved neatly.

I have a selection with a ripple effect (the boxes in the screenshot) and some, optional, sub-options:

![image](https://github.com/angular/components/assets/38611461/c17c3445-cb64-49d5-b183-2cccbd6ca555)

Now every time I hit a suboption the box' ripple effect shows up. Disabling it only on inner click and re-enabling it seams like some nasty timing problem (and even looks like [ripple gets removed on mouse down etc.]).

In my opinion there **really** is a need to be able to disabler the ripple effect for some boxes inside the ripple container. There should either be a directive for disabling it or to make things easy, like I suggested in my previous post, be able to switch from `capture` to `bubbling` so it can be disabled the _vanilla Javascript way_ (`stopPropagation`).

### Reproduction

https://stackblitz.com/edit/angular-phk79p-fyt248

### Expected Behavior

Ripple should not show up on clicking some container's child elements.

### Actual Behavior

Ripple cannot be disabled for some inner clicks.

### Environment

- Angular: 18.0.1
- CDK/Material: 18.0.0

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

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

Hướng nghiên cứu

Tái hiện hành vi nhấp lồng nhau trong StackBlitz được liên kết bằng Angular 18.0.1 và CDK/Material 18.0.0, sau đó kiểm tra việc xử lý sự kiện của MatRipple. Xác định cách các phần tử con có thể ngăn ripple của phần tử chứa mà không cần các giải pháp tạm thời phụ thuộc vào thời gian. Được xem là hoàn thành khi các lần nhấp vào những phần tử con được chỉ định không kích hoạt ripple của phần tử chứa, trong khi các lần nhấp thông thường vào phần tử chứa vẫn kích hoạt ripple.

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

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ 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.