-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Fix collapsible transition behaviour #4000
Conversation
🟡 This pull request modifies 3 files and might impact 5 other files. This is an average splash zone for a change, remember to tophat areas that could be affected. Details:All files potentially affected (total: 5)📄
|
692009a
to
4f679f3
Compare
ae4ada7
to
418e0c7
Compare
f6fd622
to
483b08a
Compare
Percy is flagging a visual regression in the loading component but I can't trace this change to any updates in that component, so everything should be okay. |
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.
Thanks for catching this @spencercanner. The dangers of re-writing a component from scratch without full test coverage. Nice work on the tests too ❤️
I left a comment around not setting props directly in tests but it looks like we do that in quite a few other places so I'll leave that up to you.
it('adds an isFullyClosed class to the collapsible onTransitionEnd if the event target is the collapsible div', () => { | ||
const id = 'test-collapsible'; | ||
const collapsible = mountWithApp(<Collapsible id={id} open />); | ||
collapsible.setProps({open: false}); |
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.
My opinion is that we should avoid setting props directly. You can create a composed component with a button and trigger on click to change the state internally.
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.
Updated!
created a separate component in the test file to handle the prop updates by triggering a button
483b08a
to
47a5065
Compare
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.
👍 Thanks again!
WHY are these changes introduced?
onTransitionEnd
logic which fully closes the collapsibleWHAT is this pull request doing?
onTransitionEnd
event that ensures it's coming from the container target, and not an element within itCollapsible
was converted to a functional componentHow to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes