-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
[Collapsible] Add Collapsible components and hooks #481
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
docs/data/base/components/collapsible/CssAnimatedCollapsible.tsx
Outdated
Show resolved
Hide resolved
return renderElement(); | ||
}); | ||
|
||
export namespace CollapsibleContent { |
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.
👍
setHeight(rect.height); | ||
} | ||
|
||
element.style.animationName = shouldCancelAnimation ? 'none' : originalAnimationName; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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:
Collapsible
s + 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/