-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(PPDSC-2115): accordion motion #264
Conversation
- Add motion support to accordion header - Add backgroundColorChange default transition present - Update test snapshots - Add transitionPreset override support - Update overrides test snapshot - Add transitionPreset override to storybook scenario
- Add maxHeightChange transition preset - Conditionally set max-height on accordion panel (to scroll height or 0) - Set maxHeightChange as default transitionPreset for accordion - Add support for accordion transitionPreset overrides on panel - Update types, tests and stories
You can preview these changes on: |
src/accordion/accordion.tsx
Outdated
const MaxHeightTransitionPanel = ({ | ||
expanded, | ||
children, | ||
overrides, | ||
}: Pick<AccordionProps, 'expanded' | 'children' | 'overrides'>) => { | ||
const ref = useRef<HTMLDivElement>(null); | ||
useEffect(() => { | ||
if (expanded) { | ||
ref.current!.style.maxHeight = `${ref.current!.scrollHeight}px`; | ||
} else { | ||
ref.current!.style.maxHeight = '0px'; | ||
} | ||
}, [expanded]); | ||
return ( | ||
<StyledPanelTransitionContainer | ||
ref={ref} | ||
expanded={expanded} | ||
overrides={overrides} | ||
> | ||
{children} | ||
</StyledPanelTransitionContainer> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good solution but I don't think is very flexible and it will not allow people to use other transition presets
You might need to use CSSTransition to make it more flexible.
- Accordion tests failing because responsiveness managed by JS: 'In Ultrafast Grid, the DOM is taken from the local rendering and rerendered on multiple devices. This works for pages that are CSS-responsive. If JS comes into picture, we need to take multiple DOMs locally, for each width on which page DOM changes.' - Add layoutBreakpoints config to fix.
… setting" This reverts commit 297abb2.
Is this "Ready for review" ? I cannot see any ticket related to 2115 in the board or review column. If not can we remove the tag? |
It is flagged (in the To Do column). I'm still waiting to hear back from Applitools about the failing tests. |
I see. I think is a bit confusing in this way? |
- Unset max height for expanded accordions. It is calculated incorrectly in the Applitools test env, causing the tests to fail.
* feat(PPDSC-2155): accordion header motion - Add motion support to accordion header - Add backgroundColorChange default transition present - Update test snapshots - Add transitionPreset override support - Update overrides test snapshot - Add transitionPreset override to storybook scenario * feat(PPDSC-2115): accordion panel transitions - Add maxHeightChange transition preset - Conditionally set max-height on accordion panel (to scroll height or 0) - Set maxHeightChange as default transitionPreset for accordion - Add support for accordion transitionPreset overrides on panel - Update types, tests and stories * feat(PPDSC-2115): update theme snapshots * feat(PPDSC-2115): fix a117 storybook issue * feat(PPDSC-2115): support other transition presets * feat(PPDSC-2115): update snapshots * feat(PPDSC-2115): update panel height on window resize * feat(PPDSC-2115): test for setting max height * feat(PPDSC-2115): add storybook config for failing tests - Accordion tests failing because responsiveness managed by JS: 'In Ultrafast Grid, the DOM is taken from the local rendering and rerendered on multiple devices. This works for pages that are CSS-responsive. If JS comes into picture, we need to take multiple DOMs locally, for each width on which page DOM changes.' - Add layoutBreakpoints config to fix. * feat(PPDSC-2115): layout breakpoints global setting * feat(PPDSC-2115): Revert "feat(PPDSC-2115): layout breakpoints global setting" This reverts commit 297abb2. * feat(PPDSC-2115): prevent animation on first render * feat(PPDSC-2115): prevent test failures - Unset max height for expanded accordions. It is calculated incorrectly in the Applitools test env, causing the tests to fail.
PPDSC-2115
What
For the header:
backgroundColorChange
as default.For the panel:
slideTop
(similar to Drawer component) but this does not work. The Drawer sits above existing content, but the Accordion panel needs to sit within the other elements on the page when expanded.scaleY
but this distorts the panel contents during the transition.maxHeight
, which seems to be the consensus: https://www.w3schools.com/howto/howto_js_accordion.aspmaxHeightChange
transition preset.maxHeightChange
as default.expanded
state. This needs to be set manually in the component as it is specific to each case (i.e. not a generic value like 100%).I have done:
I have tested manually: