[Collapsible] Add Collapsible components and hooks#481
[Collapsible] Add Collapsible components and hooks#481colmtuite merged 12 commits intomui:masterfrom
Conversation
Netlify deploy preview |
69f291b to
397ff68
Compare
397ff68 to
30e8cc0
Compare
e78e435 to
3638e68
Compare
packages/mui-base/src/Collapsible/Content/useCollapsibleContent.ts
Outdated
Show resolved
Hide resolved
0172ef8 to
939767f
Compare
939767f to
8296f06
Compare
8296f06 to
244d479
Compare
a6676a5 to
e83e63a
Compare
| return renderElement(); | ||
| }); | ||
|
|
||
| export namespace CollapsibleContent { |
| setHeight(rect.height); | ||
| } | ||
|
|
||
| element.style.animationName = shouldCancelAnimation ? 'none' : originalAnimationName; |
There was a problem hiding this comment.
I'm wondering if we need to do all this on our side. Have you considered applying the data-instant attribute and instructing users to disable all motion when it's present? (perhaps this could also solve the issue with transitions)
There was a problem hiding this comment.
@michaldudak data-instant applies conditions that last for the lifetime of the component, which is different for the cases that are handled internally here, which only disables motion for one specific instance/occurrence of the open state changing:
- When the component is initially open, on first mount/load, motion is disabled so it's just appears fully open, but animations run normally after that
- When the component uses
hidden="until-found"and is opened by in-page-search, it will open instantly, but animations run normally afterwards
I don't think these behaviors should require users to opt-in to it (or be override-able) for animated Collapsibles as it obviously results in poorer UX
Also this keeps the component easier to style, without having to add another animation state in addition to the 4 standard ones!
(I've also added a comment in the code about this here)
949ca4f to
c5289c7
Compare
c5289c7 to
3e0f351
Compare
3e0f351 to
696867a
Compare
|
@colmtuite It's ready for you to have one last look before we merge it ~ |
Closes #84
Docs: https://deploy-preview-481--base-ui.netlify.app/base-ui/react-collapsible/
Extra demos:
Collapsibles + CSS transitions: https://deploy-preview-481--base-ui.netlify.app/experiments/collapsible-accordion/hidden="until-found": https://deploy-preview-481--base-ui.netlify.app/experiments/collapsible-hidden-until-found/