Skip to content
Closed
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
31 changes: 31 additions & 0 deletions src/Elastic.Documentation.Site/Assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,23 @@ body {
@apply hover:bg-grey-20 cursor-pointer rounded-sm p-1;
}

/* On folder and heading rows the label fills the row height, so a click below the chevron of a wrapped title still
toggles; the chevron carries the button box the inner div used to. Island rows keep the div. */
.nav-folder > .peer > label {
@apply cursor-pointer;

& > .nav-chevron {
@apply box-content rounded-sm p-1;
}

/* As Tailwind's hover: does, so a tap on a touch screen leaves no grey chevron behind. */
@media (hover: hover) {
&:hover > .nav-chevron {
@apply bg-grey-20;
}
}
}

.nav-chevron {
@apply w-3.5 shrink-0 -rotate-90 group-has-checked/label:rotate-0;

Expand All @@ -223,6 +240,11 @@ body {
stroke: none;
}

/* An open folder points its chevron down; the label no longer carries the group/label class this used. */
.nav-folder > .peer > label:has(:checked) .nav-chevron {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

Add a browser regression check that clicks a legacy folder toggle and verifies subtree visibility and chevron rotation on both open and close. The updated HTML snapshots would still pass if the new checked-state selector stopped matching and the chevron stayed sideways.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this one. I checked open and close in a browser against the previous markup (checkbox state, subtree visibility and chevron rotation all match), and the sidebar screenshots, with folders open, match pixel for pixel. A dedicated browser test for the toggle is more than this markup change needs.

@apply rotate-0;
}

.nav-subtree {
@apply relative ml-4 hidden;

Expand Down Expand Up @@ -602,4 +624,13 @@ h1:has(.cli-badge-ns, .cli-badge-cmd) {
:where([id^='nav-tree-']) li.nav-top {
@apply mt-6 flex pr-8 font-semibold;
}

/* A folder or heading row's title and toggle, and the toggle's place in it: the classes the row used to carry. */
:where(.nav-folder > .peer) {
@apply grid w-full grid-cols-[1fr_auto];
}

:where(.nav-folder > .peer > label) {
@apply mr-2 flex items-start;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

Add a browser regression test that clicks below the chevron on a wrapped folder row and checks that the subtree opens and closes. The HTML snapshots cannot detect a return to a chevron-height hit area, and a test that clicks the chevron itself would pass either way.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this one. I checked it in a browser when making the change: on a wrapped folder title the label measures 22×34 as on main, and a click 3px above the bottom of the row toggles the folder. A browser test for one CSS rule is more than this markup change needs.

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,17 @@
}
else if (item.Kind == NavigationRenderNodeKind.Heading)
{
@* Folder and heading rows carry no layout classes on the peer and the toggle: styles.css sets them. *@
<li class="nav-folder @(item.IsTopLevel ? "mt-6" : "mt-4")">
<div class="peer grid grid-cols-[1fr_auto] w-full">
<div class="peer">
<span class="sidebar-link nav-folder-link@(item.IsTopLevel ? " font-semibold" : "")">
<span>@item.NavigationTitle</span>
@if (item.Badge is not null) { <span class="nav-badge nav-badge-@item.Badge">@item.Badge</span> }
</span>
@if (item.ShowToggle)
{
<label for="@item.Id" class="group/label flex mr-2 items-start">
<div class="nav-toggle-btn">
<svg class="nav-chevron" viewBox="0 0 24 24"><use href="#icon-chevron-down"/></svg>
</div>
<label for="@item.Id">
<svg class="nav-chevron" viewBox="0 0 24 24"><use href="#icon-chevron-down"/></svg>
<input
id="@item.Id"
type="checkbox"
Expand All @@ -79,18 +78,16 @@
else
{
<li class="nav-folder @(item.IsTopLevel ? "mt-6" : "mt-4")">
<div class="peer grid grid-cols-[1fr_auto] w-full">
<div class="peer">
<a href="@item.Url" class="sidebar-link nav-folder-link@(item.IsTopLevel ? " font-semibold" : "")">
<span>@item.NavigationTitle</span>
@if (item.Badge is not null) { <span class="nav-badge nav-badge-@item.Badge">@item.Badge</span> }
@await RenderPartialAsync(_NavHttpMethodGlyph.Create(item))
</a>
@if (item.ShowToggle)
{
<label for="@item.Id" class="group/label flex mr-2 items-start">
<div class="nav-toggle-btn">
<svg class="nav-chevron" viewBox="0 0 24 24"><use href="#icon-chevron-down"/></svg>
</div>
<label for="@item.Id">
<svg class="nav-chevron" viewBox="0 0 24 24"><use href="#icon-chevron-down"/></svg>
<input
id="@item.Id"
type="checkbox"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<a href="/api/test/group/endpoint-mixed" class="sidebar-link nav-folder-link font-semibold">
<span>Mixed</span>
</a>
<label for="3F8FEE62" class="group/label flex mr-2 items-start">
<div class="nav-toggle-btn">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
</div>
<label for="3F8FEE62">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
<input id="3F8FEE62" type="checkbox" class="hidden" aria-hidden="true">
</label>
<a href="/api/test/group/endpoint-retired" class="sidebar-link nav-folder-link font-semibold">
<span>Retired</span>
</a>
<label for="5B720147" class="group/label flex mr-2 items-start">
<div class="nav-toggle-btn">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
</div>
<label for="5B720147">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
<input id="5B720147" type="checkbox" class="hidden" aria-hidden="true">
</label>
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<span id="api-operations-label" class="nav-group-label">Operations</span>
<ul class="nav-group-items" aria-labelledby="api-operations-label">
<li class="nav-folder mt-4">
<div class="peer grid grid-cols-[1fr_auto] w-full">
<div class="peer">
<a href="/api/es/group/endpoint-search" class="sidebar-link nav-folder-link">
<span>Search</span>
</a>
<label for="search" class="group/label flex mr-2 items-start">
<div class="nav-toggle-btn">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
</div>
<label for="search">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
<input id="search" type="checkbox" class="hidden" aria-hidden="true">
</label>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
</div>
<ul class="block px-4" id="nav-tree-legacy-heading" hx-preserve="">
<li class="nav-folder mt-6">
<div class="peer grid grid-cols-[1fr_auto] w-full">
<div class="peer">
<span class="sidebar-link nav-folder-link font-semibold">
<span>Search &amp; Document APIs</span>
</span>
<label for="search-docs" class="group/label flex mr-2 items-start">
<div class="nav-toggle-btn">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
</div>
<label for="search-docs">
<svg class="nav-chevron" viewBox="0 0 24 24">
<use href="#icon-chevron-down"></use>
</svg>
<input id="search-docs" type="checkbox" class="hidden" aria-hidden="true">
</label>
</div>
Expand Down
Loading