Skip to content

rustdoc: add a handle that makes sidebar resizing more obvious #139420

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 22 additions & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,22 @@
/* make sure there's a 1px gap between the scrollbar and resize handle */
left: calc(var(--desktop-sidebar-width) + 1px);
}
/* visual indication that the sidebar can be resized */
.sidebar-resize-hint {
background-color: var(--sidebar-resize-hint-color);
color:

Check failure on line 525 in src/librustdoc/html/static/css/rustdoc.css

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

trailing whitespace
margin: 0 5px 5px 0;
padding: 1px 2px 4px 0;
margin-top: 16px;
border-width: 7px 6px 7px 1px;
border-style: solid;
border-color: var(--sidebar-resize-hint-color);
border-radius: 0 5px 5px 0;
font-size: 10px;
/* allow to stack with `.sidebar-resizer.active::before` */
position: abosolute;
cursor: e-resize;
}

.rustdoc.src .sidebar-resizer {
/* when closed, place resizer glow on top of the normal src sidebar border (no need to
Expand Down Expand Up @@ -585,11 +601,13 @@
margin-left: -140px;
border-left: none;
}
.sidebar-resizer.active:before {
.sidebar-resizer.active::before {
border-left: solid 2px var(--sidebar-resizer-active);
display: block;
height: 100%;
content: "";
/* allow to stack with `.sidebar-resize-hint` */
position: absolute;
}

.sidebar, .mobile-topbar, .sidebar-menu-toggle,
Expand Down Expand Up @@ -2890,6 +2908,7 @@
--settings-button-border-focus: #717171;
--sidebar-background-color: #f5f5f5;
--sidebar-background-color-hover: #e0e0e0;
--sidebar-resize-hint-color: #000a;
--code-block-background-color: #f5f5f5;
--scrollbar-track-background-color: #dcdcdc;
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
Expand Down Expand Up @@ -2995,6 +3014,7 @@
--settings-button-border-focus: #ffb900;
--sidebar-background-color: #505050;
--sidebar-background-color-hover: #676767;
--sidebar-resize-hint-color: #000a;
--code-block-background-color: #2A2A2A;
--scrollbar-track-background-color: #717171;
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
Expand Down Expand Up @@ -3107,6 +3127,7 @@
--settings-button-border-focus: #e0e0e0;
--sidebar-background-color: #14191f;
--sidebar-background-color-hover: rgba(70, 70, 70, 0.33);
--sidebar-resize-hint-color: #999;
--code-block-background-color: #191f26;
--scrollbar-track-background-color: transparent;
--scrollbar-thumb-background-color: #5c6773;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h2>Files</h2> {# #}
{% endif %}
{{ sidebar|safe }}
</nav> {# #}
<div class="sidebar-resizer"></div> {# #}
<div class="sidebar-resizer"><div class="sidebar-resize-hint">▶</div></div> {# #}
<main>
{% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
{# defined in storage.js to avoid duplicating complex UI across every page #}
Expand Down
Loading