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

AccordionBlock: use height transition instead of css only solution #416

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

SebiVPS
Copy link
Contributor

@SebiVPS SebiVPS commented Nov 7, 2024

Description

Because the css solution with margin-top: -100%; could potentially made some problems we fall back to the default ref height transition animation.

@SebiVPS SebiVPS force-pushed the update-accordion-block branch from 4a8c2f8 to aa02c0d Compare November 7, 2024 08:26
@thomasdax98 thomasdax98 removed their request for review November 11, 2024 12:40
@nsams
Copy link
Member

nsams commented Nov 12, 2024

👎 for a non-css-only solution in starter

site/src/common/blocks/AccordionItemBlock.tsx Outdated Show resolved Hide resolved
site/src/common/blocks/AccordionItemBlock.tsx Outdated Show resolved Hide resolved
site/src/common/blocks/AccordionItemBlock.tsx Outdated Show resolved Hide resolved
@johnnyomair
Copy link
Collaborator

IMO a toggle between display: none and display: block would be acceptable as well 🤷🏼‍♂️

@SebiVPS SebiVPS requested a review from johnnyomair November 26, 2024 11:37
Copy link
Collaborator

@johnnyomair johnnyomair left a comment

Choose a reason for hiding this comment

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

Waiting for a decision here: #416 (comment)

@jamesricky
Copy link
Contributor

👎 for a non-css-only solution in starter

I somewhat agree, but I don't know of another reliable way of achieving this.
And since we likely need this is 99% of projects I'd prefer this over just showing/hiding with display: none/block.

jamesricky
jamesricky previously approved these changes Dec 3, 2024
johnnyomair
johnnyomair previously approved these changes Dec 3, 2024
@nsams
Copy link
Member

nsams commented Dec 16, 2024

I don't know of another reliable way of achieving this.

Setting the inline height has so many disadvantages (and bugs) - we really must give our best to avoid that.

See here for possible solutions:
https://stackoverflow.com/questions/3508605/how-can-i-transition-height-0-to-height-auto-using-css

The max-height idea seems pretty clever.

@SebiVPS
Copy link
Contributor Author

SebiVPS commented Dec 16, 2024

Setting the inline height has so many disadvantages (and bugs) - we really must give our best to avoid that.

@nsams can you explain this? I do not know these.

The max-height idea seems pretty clever.

The max-height solution has other problems (trade offs). The transition is always towards the max-height (smaller heights are not animated properly). What do we set for max-height - any content can be inserted into the accordion item?

I am no css expert, when @mariokemetinger, @jamesricky or @johnnyomair have any other, more solid, solution feel free to talk to me :)

@johnnyomair johnnyomair requested a review from nsams December 16, 2024 10:01
@nsams
Copy link
Member

nsams commented Dec 16, 2024

can you explain this? I do not know these.

if the content changes it's height (other than window resize) the inline height won't be updated

@nsams
Copy link
Member

nsams commented Dec 16, 2024

The max-height solution has other problems

right. The stackoverflow question has 46 answers, maybe some other is working for us.

@jamesricky
Copy link
Contributor

The max-height idea seems pretty clever.

The max-height solution has other problems (trade offs). The transition is always towards the max-height (smaller heights are not animated properly). What do we set for max-height - any content can be inserted into the accordion item?

I am no css expert, when @mariokemetinger, @jamesricky or @johnnyomair have any other, more solid, solution feel free to talk to me :)

Animating height using the max-height method is a bad solution imo.
The animation speed differs depending of the size of the content, easing does't work properly and this causes a limit to the height of the content.

@SebiVPS
Copy link
Contributor Author

SebiVPS commented Dec 17, 2024

if the content changes it's height (other than window resize) the inline height won't be updated

@nsams correct me if i'm wrong, but i think there is no such case in the starter, where the content can change it's height. I think for now, this solution is working for us/the starter, better than the current one. (also most used in our projects).
If you want, @thomasdax98 can make an analyze task to find a more robust solution also respecting height changes of the content?

@nsams
Copy link
Member

nsams commented Dec 19, 2024

correct me if i'm wrong, but i think there is no such case in the starter, where the content can change it's height.

This is the starter, that starts anything you can't imagine. That's why I say it's an Okish solution for an project where you can argue that no content can change it's height. But not for starter.

Have you looked at the other 45 answers?

An alternative solution might be to unset the inline style after the animation completed. I don't know how easy that is nowadays.

@johnnyomair johnnyomair dismissed their stale review December 19, 2024 15:53

We need to evaluate if we can find a CSS-only solution.

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.

5 participants