Skip to content
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

_process func in scrollspy defaults last nav-item to be active #32600

Closed
hkung77 opened this issue Dec 23, 2020 · 4 comments
Closed

_process func in scrollspy defaults last nav-item to be active #32600

hkung77 opened this issue Dec 23, 2020 · 4 comments

Comments

@hkung77
Copy link

hkung77 commented Dec 23, 2020

OS: MacOS BigSur v11.1
Bootstrap Version: 4.5.3
Browser: Chrome Version 87.0.4280.88 (Official Build) (x86_64)

Currently my website (https://hkung.me) if you want to see it reproduced.
The third nav-item element is always being defaulted to active.

I found the source to be here:
https://github.com/twbs/bootstrap/blob/v4.5.3/js/src/scrollspy.js#L203
Where it's defaulting the last item, Perhaps there was a reason why...
why my max-height and scroll-height are canceling each other

Here is a screenshot of my debugger when figuring out whats happening.
Screen Shot 2020-12-23 at 5 31 22 PM

Maybe it should default to the first one instead?
I'm not entirely sure the depth of how much scrollspy is used so perhaps my answer is not well informed enough..

@ghost
Copy link

ghost commented Dec 24, 2020

It should ideally default to the current item being scrolled when the page was last reloaded or scrolled.
But, what they were thinking when working was that it goes to the last active nav-item rather than the last one.
This may be the cause of other scrollspy problems. But as far this issue goes its fixed!

@hkung77
Copy link
Author

hkung77 commented Dec 24, 2020

Do you mean fixed in v5? or there is a pending pull request? I will double check :)

@harnishdesign
Copy link

Duplicate of #32496

@ghost
Copy link

ghost commented Dec 24, 2020

@hkung77 migrate your project to v5 yes. In v5 it mainly deals with scrollspy and navbars, getting a bit more responsive as well!
Migrate your project fast, cause there are a ton of changes that are being worked on!

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

No branches or pull requests

2 participants