bug(Mat-Tabs): Mat-tabs on mat-dialog not working when selectedIndex change asynchronously
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
#### Reproduction
https://stackblitz.com/edit/mat-tabs-on-mat-dialog-problem
Steps to reproduce:
1. Use mat-dialog for dialog
2. Use mat-tabs for multiple tabs
3. Use selectedIndex to select tabs dynamically
4. Initialize selectedIndex value
4. Change selectedIndex asynchronously
#### Expected Behavior
I will initially see the tab of the index that I initialize first. But when I change the selectedIndex, it will switch to the new tab of that index.
#### Actual Behavior
Asynchronously changed tabs contents will go blank. The tab contains blank content. But if I add 500ms with setTimeout it works. But without this setTimeout, it dosn't work
#### Environment
- Angular: 8 or 9
- CDK/Material: 8, 10
- Chrome, Firefox
- Ubuntu, Windows
Contributor guide
Research direction
Start with the linked StackBlitz reproduction and inspect the interaction between MatTabs and MatDialog when selectedIndex changes asynchronously. Reproduce the blank tab contents without the 500ms delay, then verify that the initially selected tab and the asynchronously selected tab both render correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100