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

A small tabset oddity #1889

Closed
jonkeane opened this issue Nov 9, 2021 · 11 comments · Fixed by #1998
Closed

A small tabset oddity #1889

jonkeane opened this issue Nov 9, 2021 · 11 comments · Fixed by #1998
Labels
bug an unexpected problem or unintended behavior front end 🌷 General HTML, CSS, and JS issues

Comments

@jonkeane
Copy link
Contributor

jonkeane commented Nov 9, 2021

Thanks to @maelle (#1694) tabsets work fantastically in vignettes which is really great. They should also work (and mostly do) in other places like the home page from readme.md But I'm noticing one oddity. I can't quite tell if this is a bootstrap problem or something else going on.

I made a basic example package showing this. By default the R tab is selected, but if you scroll past it (on both safari and chrome), the css features that show that it's selected (rounded box, grey background, different color type) disappear (though the tab content remains). I also included an identical tabset in the vignette which works just fine and one can scroll past it without changing the selection indications.

https://github.com/jonkeane/simple-package has the source of the simple package.

@hadley
Copy link
Member

hadley commented Nov 9, 2021

Hmmm, so before scrolling down:

<a data-bs-toggle="tab" id="r-tab" href="#r" role="tab" aria-controls="r" aria-selected="true" class="nav-link active">R</a>

And after scrolling down:

<a data-bs-toggle="tab" id="r-tab" href="#r" role="tab" aria-controls="r" aria-selected="true" class="nav-link">R</a>

So something is stripping the active class.

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

The behaviour works on the homepage if using a README table of contents 🤯

E.g.

home:
  sidebar:
    structure: [links, toc, license, community, citation, authors, dev]

I tried this because that's the only JS thing that is different between the default homepage and a default vignette.

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

The fix is probably to not include the bootstrap-toc JS if there's no TOC otherwise it mixes with other things?!

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

Site I obtained with my pkgdown branch #1890: https://hopeful-lewin-04de2a.netlify.app/

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

(thanks a lot @jonkeane for the precise bug report & reprex!)

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

I do see an error in the console for the website mentioned above though. (from pkgdown.js)

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

That's because pkgdown.js has the line Toc.init

@maelle
Copy link
Collaborator

maelle commented Nov 9, 2021

I updated my PR and the Netlify preview.

@jonkeane
Copy link
Contributor Author

jonkeane commented Nov 9, 2021

Oh wow, that was quick! And it looks like it works perfectly. Thank you!

@hadley hadley added bug an unexpected problem or unintended behavior front end 🌷 General HTML, CSS, and JS issues labels Nov 24, 2021
@hadley
Copy link
Member

hadley commented Jan 6, 2022

Is this maybe the same problem as #1959?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior front end 🌷 General HTML, CSS, and JS issues
Projects
None yet
3 participants