Skip to content
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

Expandable table in tabs component, navigate away and navigate back from tab, causes all table rows to show expanded content #20610

Open
Sam-Davis opened this issue Sep 21, 2020 · 6 comments
Labels
area: material/expansion area: material/tabs P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@Sam-Davis
Copy link

If you put a table with expandable rows in a tab, then navigate away and navigate back, the table appears with all the rows expanded. On first opening of tab, there is no issue, so I'm guessing this is an issue happens when you navigate away, the table gets expanded (you have to then double click each row to hide expanded content).

Versions
10.0.6 @angular/cli
10.1.3 @angular/material

@jelbourn jelbourn added needs triage This issue needs to be triaged by the team needs: clarification The issue does not contain enough information for the team to determine if it is a real bug and removed needs triage This issue needs to be triaged by the team labels Sep 22, 2020
@jelbourn
Copy link
Member

This issue doesn't have enough information for the team to investigate. Can you include a StackBlitz reproduction?

@Sam-Davis
Copy link
Author

Sam-Davis commented Oct 8, 2020

Good idea. Stackblitz is here:
Stackblitz example

To create this Sackblitz, I took the example on the materials website - Table with expandable rows,. I copy pasted the table html and put each table in a different tab. If you go to tab 2 and back to tab 1, the bug is clearly visible.

@jelbourn jelbourn added needs triage This issue needs to be triaged by the team and removed needs: clarification The issue does not contain enough information for the team to determine if it is a real bug labels Oct 9, 2020
@crisbeto
Copy link
Member

crisbeto commented Oct 11, 2020

This seems identical to #20517. I looked into it a while ago and there were two problems:

  1. The tabs block child animations while they're animating.
  2. The expansion panel has a void animation which will cause it to snap into a different state when it gets detached while it's expanded.

When I tried fixing it for #20517, removing the void state ended up breaking in a different way and allowing child animations on the menu didn't make much of a difference. The setup is slightly different in mat-tab-group, compared to mat-menu, so I'm not 100% sure that it's a duplicate of #20517.

@crisbeto crisbeto added area: material/expansion area: material/tabs P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Oct 11, 2020
@Sam-Davis
Copy link
Author

Interesting. The trigger on load has the transition:

fromState: "void",
phaseName: "start"
toState: "collapsed"

The transition on switching tabs has the transition:

fromState: "collapsed"
phaseName: "start"
toState: "void"

A working transition has the transition event:

fromState: "collapsed"
phaseName: "start"
toState: "expanded"

or when collapsing:

fromState: "expanded"
phaseName: "start"
toState: "collapsed"

After the switching tabs transition has happened and it goes into state void, the transition events are no longer fired.

I've updated the stackblitz example to include a console log of the event each time it occurs. As you can see the transition event fires once for each row when the page loads of a tab is clicked.

@mgonzalez121690
Copy link

Facing same issue, any updates here or work around?
I am using angular 14.

@devAnky
Copy link

devAnky commented Nov 7, 2024

Seems to be also an issue with (vertical) stepper in Angular 18...

@crisbeto crisbeto self-assigned this Dec 5, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 5, 2024
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports.

Fixes angular#27946.
Fixes angular#22715.
Fixes angular#21434.
Fixes angular#20610.
Fixes angular#20517.
Fixes angular#17177.
Fixes angular#16534.
Fixes angular#16503.
Fixes angular#14952.
Fixes angular#14759.
Fixes angular#14075.
Fixes angular#11765.
@crisbeto crisbeto removed their assignment Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/expansion area: material/tabs P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

5 participants