New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(Tabs): ExpressionChangedAfterItHasBeenCheckedError when providing MatTabNavPanel to tabPanel input of mat-tab-nav-bar #28379
Comments
Workaround is to not using any MatTabNavPanel. Instead, create some Of course, you dont have any of the advantages of passing a real reference to the actual panel that is used to display the content selected by the mat-tab-nav-bar. |
@muenchto The example doesn't seem to be working. Can you make sure it's showing the problem effectively? |
@atscott Thanks! Seems that I did not save the stackblitz before sharing it. Fixed now. Sorry for the inconvience! |
…tab changes Using signals eliminates the `ExpressionChangedAfterItHasBeenCheckedError` when an active tab changes after the tab panel has been checked. fixes angular#28379
While this theoretically works, the ARIA accessibility is all messed up, and tabIndex on all elements is all set to -1 when using a fake tabPanel to suppress errors. (Because it thinks that none of the items are "active") So adding a fake [tabPanel] is not really a solution. |
Is this a regression?
The previous version in which this bug was not present was
Angular Material pre-MDC
Description
mat-tab-nav-bar requires a reference to it's MatTabNavPanel via the tabPanel input. Documentation says this is optional but code makes it required as reported in #26270.
However, when the mat-tab-nav-bar is wrapped in some other component, e.g. an AppHeaderComponent, but the MatTabNavPanel is outside this component, we need to pass the reference to the MatTabNavPanel via Input into the wrapper component like AppHeaderComponent and then use it in the template. This is the only way I can think of, but it throws a ExpressionChangedAfterItHasBeenCheckedError (quite obvious for everyone who understand Angular's CD resolution algorithm really good, but hard to understand for everyone else), for example
Reproduction
StackBlitz link: https://stackblitz.com/edit/udrwuw?file=src%2Fexample%2Ftab-nav-bar-basic-example.html
Steps to reproduce:
Expected Behavior
No error. I suggest simply making tabPanel optional like stated in Documentation, but of course would be nice to have a good solution to use mat-tab-nav-bar in a wrapper component
Actual Behavior
ExpressionChangedAfterItHasBeenCheckedError
Environment
The text was updated successfully, but these errors were encountered: