Skip to content

Commit

Permalink
Make hover effect on dropdown admonitions more prominent
Browse files Browse the repository at this point in the history
  • Loading branch information
gabalafou committed Sep 17, 2024
1 parent 8b36690 commit 2a1e8d7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,10 @@ html {
}
}
}

.sd-summary-title:hover {
// Use text underlining to make the hover effect more perceivable and
// therefore more accessible.
text-decoration: underline;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,32 @@
}
}

// Apply this mixin to the element that will be hovered. These styles are
// intended to match what sphinx-design does for its dropdown admonitions.
@mixin icon-hover-effects {
&:hover .tb-icon {
opacity: 1;
scale: 1.1;
}

.tb-icon {
opacity: 0.6;
}
}

// Admonition toggles
.admonition {
.admonition-title {
@include icon-hover-effects;

&:hover,
&:hover button.toggle-button {
// Use text underlining to make the hover effect more perceivable and
// therefore more accessible.
text-decoration: underline;
}
}

button.toggle-button {
color: inherit;

Expand Down Expand Up @@ -50,7 +74,7 @@
// the left border on the container's children). This makes it complicated
// to get the focus ring to simultaneously cover the left border in the
// header and align perfectly on the right with the body.
.admonition-title:focus-within::before {
.admonition-title:focus-within:has(:focus-visible)::before {
content: "";
transform: translateX(
-$admonition-left-border-width
Expand All @@ -77,6 +101,13 @@
border-left: 3px solid var(--pst-color-primary);

@include chevron-down;
@include icon-hover-effects;

&:hover {
// Use text underlining to make the hover effect more perceivable and
// therefore more accessible.
text-decoration: underline;
}
}

// When expanded, sharpen the bottom left and right corners of the focus ring
Expand Down

0 comments on commit 2a1e8d7

Please sign in to comment.