Skip to content

fix(table): animate expandable#7497

Merged
mcoker merged 3 commits intopatternfly:mainfrom
mcoker:issue-7363
May 7, 2025
Merged

fix(table): animate expandable#7497
mcoker merged 3 commits intopatternfly:mainfrom
mcoker:issue-7363

Conversation

@mcoker
Copy link
Contributor

@mcoker mcoker commented Apr 30, 2025

fixes #7363

Link - https://patternfly-pr-7497.surge.sh/components/table#expandable

To trigger the animation, in dev tools find a <tr class="pf-m-expanded pf-v6-c-table__expandable-row pf-v6-c-table__tr">, click on the ".cls" button in the top/right of dev tools (near the ":hov" hover/focus button) and toggle the .pf-m-expanded class. Here's a screenshot:

Screenshot 2025-04-30 at 6 02 02 PM

One note about this animation is, without some changes, on collapse the slide/fade runs and then the empty space collapses. I had mentioned that I expected the empty space to collapse immediately as the animation ran but I was mistaken - it collapses after the animation runs. WDYT @andrew-ronaldson @lboehling? I can update this and the other animations to collapse immediately if we prefer that interaction.

Currently table is different than some of the others because it uses display: none to hide the expandable content. As we discussed, we're OK with allowing transition-behavior: allow-discrete for that as a progressive enhancement (browser support here - https://caniuse.com/?search=allow-discrete). However, if we just go with that, then we'll also need to use @starting-style for the expand transition to work. @starting-style also doesn't have full browser support, either. Here's a TL;DR on where that stands with our official support. I'm only going to call out FF and Safari as they're the ones lagging with support for these two properties.

  • PF supports FF and Safari v17.0+
  • @starting-style only works on Safari starting v17.5. Works fine in FF.
  • transition-behavior: allow-discrete only works on Safari starting v18, and doesn't work at all in FF.

So what does that mean?

  • If you're on the latest browser of the ones we support, FF will only animate the "expand" state (due to support for @starting-style but no support for allow-discrete). Collapse animation will not work in FF.
  • If you're on Safari v17.5+ (but not on v18), same as above - expansion animation works, collapse doesn't.
  • If you're below Safari v17.5, you get no animation on expand or collapse.

I mention this because I believe I overheard that we would use allow-discrete and for anyone that uses a browser that doesn't support it, they would get the expand animation but not the collapse animation, and I wanted to call out that if you're below Safari v17.5, you won't get either.

If that's OK then 🚀. If not, we can work around it, we'll probably just need to add a new class or two and react will need an update, too.

@patternfly-build
Copy link
Collaborator

patternfly-build commented Apr 30, 2025

--#{$table}__action--PaddingInlineEnd: var(--pf-t--global--spacer--sm);

// * Table expandable row
--#{$table}__expandable-row--TransitionDuration--display: var(--#{$table}__expandable-row--TransitionDuration--fade);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing where this is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I realized I didn't need that and forgot to delete.

--#{$table}__expandable-row--TransitionDuration--slide: var(--#{$table}__expandable-row--TransitionDuration--expand--slide);
--#{$table}__expandable-row--TransitionDuration--fade: var(--#{$table}__expandable-row--TransitionDuration--expand--fade);
--#{$table}__expandable-row--TransitionTimingFunction: var(--pf-t--global--motion--timing-function--default);
--#{$table}__expandable-row--TransitionDelay: 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a delay needed for this animation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - forgot to delete.

Copy link
Collaborator

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏓

Copy link
Member

@srambach srambach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@mcoker mcoker merged commit cf30724 into patternfly:main May 7, 2025
4 checks passed
@mcoker mcoker deleted the issue-7363 branch May 7, 2025 21:51
@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.3.0-prerelease.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

mcoker added a commit to mcoker/patternfly that referenced this pull request Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Animation: Table - Expandable table rows (Core)

5 participants