Join the Webstudio community

Updated 3 weeks ago

Accordion - open first one inside Content Block

I there any chance to keep first radix accordion inside content block open? It seems like it considers content block template as a first one and it stays open while actual first item it considers as second one and it's closed.
Attachment
Screenshot_2025-02-25_132030.png
O
b
B
33 comments
I am not sure Content Block inside Accordion is supposed to work. cc @Bogdan
It works fine, I am able to add accordion in content mode. But only problem - first item is not open.
so you are talking about the defaul open item when rendered on canvas? I am confused about the screenshot from navigator.
I guess the problem is that each item should have unique value. Native details does this automatically.
Yes. I mean default open item. If I use accordion outside content block - it has first item open by default.
If I use accordion inside content block - it considers first item a content block template accordion and keeps it open, so real first item is not open.
is this happening on the published site too?
strange, because on the published one there is no template
generally default value is controlled by this setting
Attachment
image.png
Yes, I checked in inspector and there is not template there. But still first accordion is closed in this case
check values of the items and what's in the default
each item has a value
Yes, manually switching this value to 1 in first item helped! Thanks!
what was initially in those values?
and default was 0?
I wonder why it had the first open at all
They all were empty. Even first one which was open.
yeah, which makes me wonder how that worked lol
We actually have a default value which is an index within accordion. So it should work. The thing is the item inside of template is counted as well.
So it got 0 which is default to expand
I think we can just skip template when traverse for index value
Mind to raise a hug?
why does it know about it though on the published site
it can't see the template
Because item from template is not rendered on published site
but why did it not work according to @beer_valera on the published site if the template item is not rendered πŸ™‚
0th index would be the first item in this case as it should be
Ah, so the problem it is not expanded. Then computing does not ignore template.
Anyway need to do this in both builder and compiler
Add a reply
Sign up and join the conversation on Discord