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

Fix table of contents sidebar overlapping with EthicalAds placement #295

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

laymonage
Copy link
Member

@laymonage laymonage commented Oct 29, 2024

Fixes #293.

Demo

Before

Screen.Recording.2024-10-29.at.10.22.17.mov

After

Screen.Recording.2024-10-29.at.10.20.50.mov

Issue recap

EthicalAds placement is done with the following CSS:

[data-ea-style=stickybox].loaded {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

Meanwhile, our sidebars use Bootstrap's sticky-top class that applies the following:

@supports (position: sticky) {
    .sticky-top {
        position: sticky;
        top: 0;
        z-index: 1020;
    }
}

There are a few ways we could go about this.

  1. Change the z-index of the sticky-top class from Bootstrap, that we use for both sidebars.
  2. Add styles for [data-ea-style=stickybox].loaded. This seems brittle.
  3. Use our own CSS to apply the stickiness. For example, with the following CSS:
    .sticky {
      position: sticky;
      top: 0;
      z-index: 20;
    }
    And then use it in the following places:
    <div id="collapseSidebar" class="collapse sticky-top d-lg-block pt-5 pr-lg-4">
    <div class="sticky-top toc page-toc" aria-labelledby="page-toc-heading">

This PR uses approach 1. I changed all of the z-index values and not just the sticky one, because Bootstrap's docs says the following:

We don’t encourage customization of these individual values; should you change one, you likely need to change them all.

I'm not sure of the implications this may have though, but from what I can tell our theme doesn't use dropdowns, fixed, modals, popovers, or tooltips.

@laymonage laymonage self-assigned this Oct 29, 2024
Comment on lines +220 to +226
$zindex-dropdown: 10;
$zindex-sticky: 20;
$zindex-fixed: 30;
$zindex-modal-backdrop: 40;
$zindex-modal: 50;
$zindex-popover: 60;
$zindex-tooltip: 70;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bootstrap's docs says the following:

We don’t encourage customization of these individual values; should you change one, you likely need to change them all.

@thibaudcolas thibaudcolas merged commit 4d642a5 into main Oct 31, 2024
3 of 4 checks passed
@thibaudcolas thibaudcolas deleted the fix-toc-z-index branch October 31, 2024 15:36
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

Successfully merging this pull request may close these issues.

Table of contents overlaps EthicalAds placement
2 participants