Skip to content
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

Accordion Example: Add animation on expand/collapse #843

Closed
wants to merge 1 commit into from
Closed

Accordion Example: Add animation on expand/collapse #843

wants to merge 1 commit into from

Conversation

hiwelo
Copy link

@hiwelo hiwelo commented Aug 18, 2018

Update of the CSS for the accordion example to add an expand/collapse animation as described in the issue #597.

For an accessibility purpose to people with some cognitive impairments, I added to media query to remove the animation if users configured reduced-motion on their device.

@mcking65
Copy link
Contributor

Thank you @hiwelo for this contribution! Before merging this, I'd like to get #838 done and merged as that one is blocking development of tests by @spectranaut. As soon as we have #838 done, I'll come back to this.

@mcking65 mcking65 requested a review from sh0ji September 24, 2018 18:48
@hiwelo
Copy link
Author

hiwelo commented Oct 23, 2018

@mcking65 now that the #838 is merged, do you want to merge this one?

@mcking65
Copy link
Contributor

mcking65 commented Dec 4, 2018

Friendly ping to @sh0ji ... could you please review this?

Copy link
Contributor

@sh0ji sh0ji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm relatively certain that an effective disclosure/accordion animation cannot be accomplished in pure CSS. The issue is that you have to transition the box model (preferably shrink an outer box so that the actual inner content is simply obscured via overflow: hidden), and THEN switch the visibility/display. That has to be reversed when opening—switch to visible, then transition.

This can be accomplished with a combination of a transitionend listener and requestAnimationFrame, but not without them as far as I'm aware. I'd love to be wrong about this!

@@ -80,3 +86,10 @@ input {
font-size: inherit;
padding: .3em .5em;
}

/* Applies styles when Reduced Motion is enabled */
@media screen and (prefers-reduced-motion: reduce) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

padding-top: 0;
padding-bottom: 0;
border-top: 0;
visibility: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting visibility to hidden here prevents the majority of the animation from happening since it causes the element to have no height, which in turn means that the height cannot transition to 0. The end result is that only the padding is actually transitioning.

@mcking65
Copy link
Contributor

mcking65 commented Dec 5, 2018

@sh0ji, thank you for the review.

@hiwelo, sorry for the very long delay on this. Given comments by @sh0ji, what would you like to do? I will close this PR for now. We can either re-open or start a new one if you have time to work on it more.

BTW, We are wrapping up change for release 3 this month. We'll start on the June release in January.

@mcking65 mcking65 closed this Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants