[FR] afterClosed for MatMenuTrigger and MatMenu
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
#### Bug, feature request, or proposal:
feature request
#### What is the expected behavior?
I want to be able to detect when a menu is completely closed (after the animation is done)
#### What is the current behavior?
there is a `menuClosed` event that is called when menu is about to be clsoed
#### What is the use-case or motivation for changing an existing behavior?
After menu item selected, I want to update a service the affects the displayed menu panel. Current menuClosed is too early, and it will cause the panel to reflect the change during the close animation.
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
angular 6.0.6, material 6.3.0
#### Is there anything else we should know?
workarounds:
1. ```js
onMenuClosed() {setTimeout(() => { /* doing stuff */ }, 500);}
1. ```js
@ViewChild(MatMenu) myMenu: MatMenu;
// ...
onMenuClosed() {
this.myMenu._animationDone
.pipe(filter(event => event.toState === 'void'), take(1))
.subscribe(() => {
/* doing stuff */
});
}
コントリビューションガイド
調査の方向性
まず MatMenuTrigger と MatMenu のイベントライフサイクルを読み、特に既存の menuClosed イベントと参照されている _animationDone ストリームを確認します。閉じるアニメーションが完了するタイミングを確認し、両コンポーネントの公開 afterClosed 動作を定義します。タイムアウトや非公開 API に依存せず、メニューが完全に閉じた後にコンシューマーが反応できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100