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 positioning for detail toggles on mobile. #84602

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 55 additions & 55 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,60 @@ h4 > .notable-traits {
border-top: 1px solid;
}

/* The hideme class is used on summary tags that contain a span with
placeholder text shown only when the toggle is closed. For instance,
"Expand description" or "Show methods". */
details.rustdoc-toggle > summary.hideme {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of "hideme", what do you think about "hide-me"? Easier to read.

Copy link
Member

Choose a reason for hiding this comment

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

Same for all below.

cursor: pointer;
}

details.rustdoc-toggle > summary::-webkit-details-marker {
Copy link
Member

Choose a reason for hiding this comment

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

Is there an equivalent on firefox?

display: none;
}

details.rustdoc-toggle > summary.hideme > span {
margin-left: 9px;
}

details.rustdoc-toggle > summary::before {
content: "[+]";
font-weight: 300;
font-size: 0.8em;
letter-spacing: 1px;
cursor: pointer;
}

details.rustdoc-toggle > summary.hideme::before {
position: relative;
}

details.rustdoc-toggle > summary:not(.hideme)::before {
position: absolute;
left: -23px;
}

/* When a "hideme" summary is open and the "Expand description" or "Show
methods" text is hidden, we want the [-] toggle that remains to not
affect the layout of the items to its right. To do that, we use
absolute positioning. Note that we also set position: relative
on the parent <details> to make this work properly. */
details.rustdoc-toggle[open] > summary.hideme {
position: absolute;
}

details.rustdoc-toggle[open] {
position: relative;
}

details.rustdoc-toggle[open] > summary.hideme > span {
display: none;
}

details.rustdoc-toggle[open] > summary::before {
content: "[−]";
display: inline;
}

/* Media Queries */

@media (min-width: 701px) {
Expand Down Expand Up @@ -1573,7 +1627,7 @@ h4 > .notable-traits {
left: -10px;
}

.item-list > details.rustdoc-toggle > summary:not(.hideme)::before {
details.rustdoc-toggle > summary:not(.hideme)::before {
left: -10px;
}

Expand Down Expand Up @@ -1770,57 +1824,3 @@ div.name.expand::before {
left: -15px;
top: 2px;
}

/* The hideme class is used on summary tags that contain a span with
placeholder text shown only when the toggle is closed. For instance,
"Expand description" or "Show methods". */
details.rustdoc-toggle > summary.hideme {
cursor: pointer;
}

details.rustdoc-toggle > summary::-webkit-details-marker {
display: none;
}

details.rustdoc-toggle > summary.hideme > span {
margin-left: 9px;
}

details.rustdoc-toggle > summary::before {
content: "[+]";
font-weight: 300;
font-size: 0.8em;
letter-spacing: 1px;
cursor: pointer;
}

details.rustdoc-toggle > summary.hideme::before {
position: relative;
}

details.rustdoc-toggle > summary:not(.hideme)::before {
position: absolute;
left: -23px;
}

/* When a "hideme" summary is open and the "Expand description" or "Show
methods" text is hidden, we want the [-] toggle that remains to not
affect the layout of the items to its right. To do that, we use
absolute positioning. Note that we also set position: relative
on the parent <details> to make this work properly. */
details.rustdoc-toggle[open] > summary.hideme {
position: absolute;
}

details.rustdoc-toggle[open] {
position: relative;
}

details.rustdoc-toggle[open] > summary.hideme > span {
display: none;
}

details.rustdoc-toggle[open] > summary::before {
content: "[−]";
display: inline;
}