Skip to content

Scrollspy active elements are discontinuous #41361

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

Open
3 tasks done
brjann opened this issue Apr 9, 2025 · 0 comments
Open
3 tasks done

Scrollspy active elements are discontinuous #41361

brjann opened this issue Apr 9, 2025 · 0 comments
Labels

Comments

@brjann
Copy link

brjann commented Apr 9, 2025

Prerequisites

Describe the issue

There is an issue (#37302) for this, which was closed with a recommendation to "include the whole wrapper as an observable https://getbootstrap.com/docs/5.2/components/scrollspy/#nested-nav" . But I believe that the other examples should work as expected and not show the discontinuous behavior.

Problem

According to the docs "Scrollspy toggles the .active class on anchor () elements when the element with the id referenced by the anchor’s href is scrolled into view." In Bootstrap 4, the .active class remained even if the referenced element disappeared from view when scrolling down until the next referenced element appears into view. And if one scrolls up, the previous referencing element got the .active class.

However, in Bootstrap 5, the .active class is only set if the referenced element is visible. If one scrolls down/up and not referenced element is in view, no referencing element gets the .active class.

Reduced test cases

The difference in behavior can be seen here, based on the List group example (https://getbootstrap.com/docs/5.3/components/scrollspy/#list-group and https://getbootstrap.com/docs/4.6/components/scrollspy/#example-with-list-group)

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

v5.3 and v4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants