'Bootstrap missing top accordion border when accordion-items hidden

I have a Bootstrap 5 accordion component on my page. I also have a JavaScript snippet that makes one or multiple accordion-items of this accordion hide depending on user search.

When the top accordion-idem is hidden, visible accordion-items underneath it have a missing top border. Is there a way to fix this behaviour?



Solution 1:[1]

I experienced the same issue when I put a 10px margin between my accordion items. The top border was missing on every item after the first, because they are designed to share a border between themselves. I am not sure if this is the best solution, but adding a border-top of 1px on the accordion item class fixed it for me, and now every accordion item had a full border!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1