angular / angular/components

bug(material/tooltip): tooltip inside sidenav hides after text update

オープン
#27,782 コメント 6 件 リアクション 3 件 担当者 0 名 GitHub で見る
area: material/tooltip help wanted 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

_No response_

### Description

When the tooltip component overflows a parent sidenav and its text content is updated dynamically, it hides.

We have debugged the code, and this happens because the sidenav component extends the cdk-scrollable.

The piece of code that calls the tooltip hide function is the following:
https://github.com/angular/components/blob/bae953999407fd385b1d571e04350bf0f28abf05/src/material/tooltip/tooltip.ts#L510-L520

### Reproduction

Stackblitz url:
https://stackblitz.com/edit/stackblitz-starters-wbd1hh?file=src%2Ftooltip-sidenav%2Ftooltip-sidenav.component.html

As you can see on the stackBlitz example, we have two tooltips:
- The tooltip inside the sidenav, which overflows the sidenav component. That if we update the tooltip text, the tooltip disappears. (BUG)
- On the other hand, we have the tooltip inside the mat-sidenav-content which works properly, and it doesn't hide after updating it. (WORKS WELL because doesn't overflow the parent)

### Expected Behavior

The tooltip inside the sidenav should not hide when the text is updated.

### Actual Behavior

The tooltip placed inside the sidnav that overflows is hidden suddenly when the text is updated.

### Environment

- Angular: v16.2.4
- CDK/Material: v16.2.3
- Browser(s): Google chrome Versión 116.0.5845.187, Firefox 117.0
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

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

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

調査の方向性

Start with src/material/tooltip/tooltip.ts around lines 510-520 and reproduce the issue using the linked StackBlitz example. Compare the overflowing tooltip inside mat-sidenav with the working tooltip inside mat-sidenav-content, then run the relevant tooltip and sidenav tests if available. Done means updating the overflowing tooltip text no longer hides the tooltip.

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

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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