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 sidebar overflow-y behavior #1776

Merged
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
12 changes: 8 additions & 4 deletions assets/css/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,18 @@
font-weight: bold;
}

.sidebar .full-list {
margin: 0;
padding: 20px 0;
.sidebar .sidebar-tabpanel {
flex: 1 1 .01%;
overflow-y: auto;
overscroll-behavior: contain;
position: relative;
-webkit-overflow-scrolling: touch;
flex: 1 1 .01%;
}

.sidebar .full-list {
margin: 0;
padding: 20px 0;
position: relative;
}

.sidebar .full-list :is(li, a) {
Expand Down
6 changes: 3 additions & 3 deletions lib/ex_doc/formatter/html/templates/sidebar_template.eex
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@
</ul>
</div>

<div id="extras-tab-panel" role="tabpanel" aria-labelledby="extras-list-tab-button">
<div id="extras-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="extras-list-tab-button">
<ul id="extras-full-list" class="full-list"></ul>
</div>

<%= if nodes_map.modules != [] do %>
<div id="modules-tab-panel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>
<div id="modules-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>
<ul id="modules-full-list" class="full-list"></ul>
</div>
<% end %>

<%= if nodes_map.tasks != [] do %>
<div id="tasks-tab-panel" role="tabpanel" aria-labelledby="tasks-list-tab-button" hidden>
<div id="tasks-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="tasks-list-tab-button" hidden>
<ul id="tasks-full-list" class="full-list"></ul>
</div>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion test/ex_doc/formatter/html/templates_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
~r{<li>[\s\n]*<button id="modules-list-tab-button" role="tab" data-type="modules" aria-controls="modules-tab-panel" aria-selected="false" tabindex="-1">[\s\n]*Modules[\s\n]*</button>[\s\n]*</li>}

assert content =~
~r{<div id="modules-tab-panel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>[\n\s]*<ul id="modules-full-list" class="full-list"></ul>[\n\s]*</div>}
~r{<div id="modules-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>[\n\s]*<ul id="modules-full-list" class="full-list"></ul>[\n\s]*</div>}

refute content =~ ~r{id="tasks-list-tab-button"}
refute content =~ ~r{id="tasks-full-list"}
Expand Down
Loading