angular / angular/components

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

オープン
#29,133 コメント 4 件 リアクション 4 件 担当者 0 名 GitHub で見る
area: material/core P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### 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

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

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

調査の方向性

リンクされた StackBlitz で、Angular 18.0.1 と CDK/Material 18.0.0 を使用してネストされたクリックの動作を再現し、その後 MatRipple のイベント処理を調査します。時間に依存する回避策を使わずに、子要素が親の ripple を抑制できる方法を特定します。指定された子要素へのクリックでコンテナの ripple が発生せず、通常のコンテナへのクリックでは引き続き発生することを確認できれば完了です。

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

評価

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

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

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