SOLVED: Accordion Content Auto-Scrolls Inappropriately Under Certain Circumstances

Bricks Version: 1.3.7
Browser: Edge
OS: Windows
URL: E-Book Creation and Distribution Service for Authors

I have an accordion with seven content elements. The elements behave correctly when opened in most cases… unless an element several below a currently opened element is opened.

For example, using the provided link: Open “Why Not Use a Free Solution?” Then, open “How Does This Work.” The page scrolls so that the beginning of the content for “How Does This Work” is not visible (you have to scroll up to get to it).

This doesn’t seem to happen when consecutive / adjoining elements are opened. And obviously, the behavior is a sub-optimal user experience.

Any one run into this? Are there any fixes?

Thanks!

Hi Matthew,
as far as I can see it is not a bug. The behavior is caused by the top item closing, reducing the height. This is also the case with items that follow each other directly, depending on your scroll position and the length of the content.

The only way around this is to enable “behave like tabs”. This way the height is preserved.

I just compared this with the Bootstrap Accordion and the behavior is 1:1 the same: https://vimeo.com/711979369/ba2cb592c1

Best regards,
timmse

1 Like

Hmmmm… well, if it’s not a bug, it’s certainly not a great user experience. When you click on a FAQ entry, you expect to begin reading the beginning of the answer to the question, not the middle of the answer to the question. :wink: The Bricks accordion working exactly like Bootstrap doesn’t necessarily mean it’s as good as it can be. Any thoughts on a workaround while still maintaining the accordion use (not converting to tabs, which have their own issues)?

1 Like

As I said, it depends a lot on the scroll position and the length of the content. After all, we have no influence on that :smirk:

I had a similar thing I think, I ticked independent toggle to make it stop scrolling into the footer when accordions were opened up. Is there no option in Bricks to had the others close when a new one is opened? It doesn’t seem to work like that does it?

Oddly it only scrolls to the footer position if another one was open, regardless of how much content was in it. I was using perfmatters as well with this, I wonder if that ‘could’ have an impact on the accordion Js if it gets deferred? It did seem 100% like the scroll posiiton as this OP mentions though.

Hey Rob,

This would be the default setting with “independent toggle” disabled, which works great for me.

Without seeing the problem myself and knowing what you’re expecting, I’m afraid I can’t say anything further :v:

Thanks Stefan. Sorry yes, if once again I’m the only one with this issue I get that.

That wasn’t working for me in that case when I had “independent toggle” disabled. They all stayed open.

Current page now I have “independent toggle” enabled: Marketing & Fundraising Manager - Lifeworks

I’ve moved it how it was before to this pw protected page, password: bricks
Bricks Private - Lifeworks - oddly, it works!

The only difference was this was on an single CPT post page before (job) and pulling in ACF data, which is seemingly what was causing the problem there. Have you tried accordions, on a single page (CPT or post) and then pulling in ACF textarea data input in those posts and tried the accordions?

Also, a screenshot of the settings on the private one:

No, of course not :smiley: That’s why we always ask for as many details as possible to be able to reproduce the problem. Anyway: even with this, I have no problems at all (within a custom post type and ACF Textarea fields):

CleanShot 2023-08-16 at 09.02.02

Please disable your plugins and custom code. This is the only thing that could affect the accordion behavior.

Hmm, that is REALLY strange but thanks for testing it. I have it working as you saw just like you do there, with the same plugins and everything. It was purely when I had the ACF content coming in that I saw it starting to break, so it makes it more confusing why a plugin would affect just that, other than the ACF one.