primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Accordion (Tailwind): AccordionTabs collapse delayed

Open sdwillbrand opened this issue 1 year ago • 10 comments

Describe the bug

When closing the AccordionTab the transition delays a bit.

Reproducer

https://codesandbox.io/p/sandbox/primereact-bug-accordion-collapse-delayed-9yrj8d

PrimeReact version

10.3.0

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Create Accordion with AccordionTab
  2. Toggle AccordionTab

Expected behavior

Smooth transitioning when closing the AccordionTab

sdwillbrand avatar Dec 06 '23 14:12 sdwillbrand

I assume this is unstyled or tailwind related because the showcase transitions fine? https://primereact.org/accordion/#basic

melloware avatar Dec 06 '23 14:12 melloware

We suspect the same.

sdwillbrand avatar Dec 06 '23 14:12 sdwillbrand

Hmm take a look at this: https://codesandbox.io/p/sandbox/primereact-bug-accordion-collapse-delayed-forked-98s696

melloware avatar Dec 06 '23 14:12 melloware

Yeah that looks good. We found an edge case, where a small content causes the delay. For instance here, the first and second tab do have a delay, but the third with the larger content does not have a delay.

Does the transition starts at a fixed height?

sdwillbrand avatar Dec 06 '23 14:12 sdwillbrand

All I see in the tailwind stuff is this?

 "p-5 transition duration-200 ease-in-out rounded-t-md font-bold transition-shadow duration-200", // Padding and transition

melloware avatar Dec 06 '23 15:12 melloware

There is also a transition attribute:

 transition: TRANSITIONS.toggleable

I think PrimeReact adds classes to the AccordionTab when the Tab is toggled. If you inspect the AccordionTab while toggling you see for a short moment the classes, max-h-40 !max-h-40 overflow-hidden transition-all duration-500 ease-in-out. I am not sure if that causes a small AccordionContent to be collapsed by a tiny delay.

sdwillbrand avatar Dec 06 '23 15:12 sdwillbrand

Yep you are right:

    toggleable: {
        timeout: 500,
        classNames: {
            enter: 'max-h-0',
            enterActive: '!max-h-40 overflow-hidden transition-all duration-500 ease-in-out',
            exit: 'max-h-40',
            exitActive: '!max-h-0 overflow-hidden transition-all duration-500 ease-in'
        }
    },

melloware avatar Dec 06 '23 15:12 melloware

@countersoda i want to test this again after the next release to see if it is the same or worse. I can't quite figure out why its delayed.

melloware avatar Dec 08 '23 22:12 melloware

@melloware Appreciated

sdwillbrand avatar Dec 11 '23 08:12 sdwillbrand

@countersoda 10.3.0 is out and looks like the same behavior. I can't explain it!

melloware avatar Jan 05 '24 16:01 melloware

Same issue but with PanelMenu component when there are over 3 items inside the dropdown. @melloware thanks for the redirect! any additional info on status for this since i see its been open since december ?

Tarik1700 avatar Mar 15 '24 11:03 Tarik1700

@Tarik1700 yeah i took a look at it but i am not that familiar with Tailwind. So PR is welcome if not if you need immediate help I suggets you check out PrimeReact PRO support.

melloware avatar Mar 15 '24 11:03 melloware