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

5.2.x tab.show() makes the page scroll to tab #37107

Closed
3 tasks done
vancanneytsander opened this issue Sep 8, 2022 · 4 comments · Fixed by #37146
Closed
3 tasks done

5.2.x tab.show() makes the page scroll to tab #37107

vancanneytsander opened this issue Sep 8, 2022 · 4 comments · Fixed by #37146
Labels

Comments

@vancanneytsander
Copy link

Prerequisites

Describe the issue

Since 5.2.0 when firing:
const tab = new bootstrap.Tab('#myTab')
tab.show()

the page scrolls to the activated tab. Which is an unwanted behavior that occurs since 5.2.0

prior to 5.2.0, the normal behavior was that the tab is shown, but doesn't scroll to the activated tab. If I revert to the bundles js from 5.1.3 no issue.

Tested on Chrome, Safari and Firefox. Chrome and Safari have same issue.

Reduced test cases

To reproduce, visit https://www.spaceweatherlive.com/en.html
Select tab 'Solar activity'
There you select tab 'Epam'
Now reload the page so that tab.show('') gets fired to activate selected tabs, you'll see that it scrolls to the last tab that was activated by the javascript call.

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

macOS

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

Chrome, Safari

What version of Bootstrap are you using?

5.2.1

@vancanneytsander vancanneytsander changed the title 5.2.x 5.2.x tav.show() makes the page scroll to tab Sep 8, 2022
@vancanneytsander vancanneytsander changed the title 5.2.x tav.show() makes the page scroll to tab 5.2.x tab.show() makes the page scroll to tab Sep 8, 2022
@GeoSot
Copy link
Member

GeoSot commented Sep 13, 2022

It can be solved adding focus({preventScroll:false}), but maybe @patrickhlauke can enlighten us for the right behavior (or if it should be optioned)

@patrickhlauke
Copy link
Member

the show() method should probably not also trigger a change of focus position (which seems to be what's happening here). leave it up to authors to do what they want with their focus.

@GeoSot
Copy link
Member

GeoSot commented Sep 15, 2022

@vancanneytsander
Copy link
Author

Tested and can confirm this solves this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants