I have been working on creating a scrollable list with "sticky" headers. The functionality seems to be in place, but there are some visual glitches that I've encountered.
The list itself is structured using a ul
element styled with the Bootstrap 5
class list-group
. In its initial state, it appears like this:
https://i.sstatic.net/Bhg3t.png
Upon scrolling, the two levels of headers stick as expected:
https://i.sstatic.net/UV6Iv.png
https://i.sstatic.net/8pQbY.png
The screenshots reveal that the border between the stuck headers disappears. This seems to be default behavior in browsers, which doesn't particularly bother me. However, when further scrolling causes the second "First Level" header to stick, the behavior becomes inconsistent. The top border vanishes, and a new border separates the two stuck headers instead:
https://i.sstatic.net/pI7m1.png
If I continue scrolling, the issue persists:
https://i.sstatic.net/P3GJ1.png
You can access the full source code at: JSFiddle
I'm uncertain if this behavior is intended or if there's a way to resolve it. Any insights would be appreciated!