Skip to content
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
1 change: 1 addition & 0 deletions changelog.d/fixed-19282-sidebar-group-indent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Dashboard sidebar entries under Collaborate, Resources, Intelligence, Admin, Help and Filters now line up with the Dashboard group's entries (#19282). Only Dashboard entries carried a reorder grip, and that hidden grip was what indented them. Every sidebar entry now reserves the same grip-wide gutter through one shared `.oc-nav-item` rule, and a grip draws inside that gutter, so Dashboard and agent rows keep their position and the other groups move in to match.
64 changes: 64 additions & 0 deletions src/pkg/dashboard/sidebar_nav_indent_19282_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package dashboard

import (
"regexp"
"strings"
"testing"
)

// cssRuleBody returns the declaration block of the first rule whose selector
// list is exactly selector, or "" when there is none.
func cssRuleBody(css, selector string) string {
re := regexp.MustCompile(`(?m)^\s*` + regexp.QuoteMeta(selector) + `\s*\{([^}]*)\}`)
m := re.FindStringSubmatch(css)
if m == nil {
return ""
}
return m[1]
}

// TestSidebarNavItemsShareOneIndent guards #19282: only Dashboard entries got
// a reorder grip, and that hidden grip was the only thing indenting them, so
// Collaborate, Resources, Intelligence, Admin, Help and Filters entries sat
// flush left. Every entry now reserves the same grip-wide gutter through one
// .oc-nav-item rule, and a grip draws inside that gutter instead of adding to it.
func TestSidebarNavItemsShareOneIndent(t *testing.T) {
html := indexHTML(t)

for _, want := range []string{
"--oc-nav-grip-w:",
"--oc-nav-child-inset: calc(var(--oc-nav-grip-w) + var(--oc-nav-item-gap))",
} {
if !strings.Contains(html, want) {
t.Errorf("sidebar tokens missing %q", want)
}
}

item := cssRuleBody(html, ".oc-nav-item")
if item == "" {
t.Fatal("no .oc-nav-item rule found")
}
if !strings.Contains(item, "calc(var(--oc-nav-item-pad-x) + var(--oc-nav-child-inset))") {
t.Errorf(".oc-nav-item must reserve the shared grip gutter in its left padding; got %q", item)
}
if !strings.Contains(item, "gap: var(--oc-nav-item-gap)") {
t.Errorf(".oc-nav-item gap must use --oc-nav-item-gap so the gutter matches the grip spacing; got %q", item)
}

grip := cssRuleBody(html, ".oc-nav-item > .oc-nav-drag-handle:first-child")
if !strings.Contains(grip, "margin-left: calc(-1 * var(--oc-nav-child-inset))") {
t.Errorf("a leading grip must sit inside the shared gutter (negative inset margin); got %q", grip)
}

handle := cssRuleBody(html, ".oc-nav-drag-handle, .oc-nav-hide-toggle")
if !strings.Contains(handle, "width: var(--oc-nav-grip-w)") {
t.Errorf("grip width must come from --oc-nav-grip-w so the gutter tracks it; got %q", handle)
}

// No per-group indentation: the fix is one shared rule, not a pixel
// override per sidebar group.
perGroup := regexp.MustCompile(`#(dashboard-section|collaborate|hf)-nav-group[^{]*\.oc-nav-item[^{]*\{[^}]*padding`)
if perGroup.MatchString(html) {
t.Error("sidebar groups must not carry their own .oc-nav-item padding; use the shared gutter")
}
}
19 changes: 16 additions & 3 deletions src/pkg/dashboard/static-src/css/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,29 @@
.oc-nav-label::after {
content: ''; flex: 1; height: 1px; background: var(--border);
}
/* Every sidebar entry reserves a leading gutter as wide as the reorder
grip plus the row gap. Reorderable entries (Dashboard group, agents)
draw their grip inside that gutter; entries without a grip (Collaborate,
Resources, Intelligence, Admin, Help, Filters) keep it empty, so all
groups line up at the same indent (#19282). */
:root {
--oc-nav-grip-w: 1.25rem;
--oc-nav-item-gap: var(--sp-3);
--oc-nav-item-pad-x: 12px;
--oc-nav-child-inset: calc(var(--oc-nav-grip-w) + var(--oc-nav-item-gap));
}
.oc-nav-item {
display: flex; align-items: center; gap: var(--sp-3);
padding: 5px 12px; font-size: var(--fs-base); color: var(--muted);
display: flex; align-items: center; gap: var(--oc-nav-item-gap);
padding: 5px var(--oc-nav-item-pad-x) 5px calc(var(--oc-nav-item-pad-x) + var(--oc-nav-child-inset));
font-size: var(--fs-base); color: var(--muted);
cursor: pointer; text-decoration: none; border-radius: var(--r);
transition: background 0.15s, color 0.15s;
margin: 1px 8px; position: relative;
min-height: 28px; overflow: hidden;
}
.oc-nav-drag-handle, .oc-nav-hide-toggle { width: 1.25rem; height: 1.25rem; min-width: 1.25rem; padding: var(--sp-0); margin: var(--sp-0); border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--muted); line-height: 1; cursor: grab; opacity: 0; display: inline-flex; align-items: center; justify-content: center; touch-action: none; }
.oc-nav-drag-handle, .oc-nav-hide-toggle { width: var(--oc-nav-grip-w); height: var(--oc-nav-grip-w); min-width: var(--oc-nav-grip-w); padding: var(--sp-0); margin: var(--sp-0); border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--muted); line-height: 1; cursor: grab; opacity: 0; display: inline-flex; align-items: center; justify-content: center; touch-action: none; }
.oc-nav-hide-toggle { cursor: pointer; margin-left: auto; font-size: var(--fs-xs); }
.oc-nav-item > .oc-nav-drag-handle:first-child { margin-left: calc(-1 * var(--oc-nav-child-inset)); }
.oc-nav-item:hover .oc-nav-drag-handle, .oc-nav-drag-handle:focus-visible, .oc-nav-drag-handle[aria-pressed="true"], .oc-nav-item:hover .oc-nav-hide-toggle, .oc-nav-hide-toggle:focus-visible, .oc-nav-hide-toggle[aria-pressed="true"] { opacity: 1; color: var(--text); border-color: var(--border); background: var(--surface-2); outline: none; }
.oc-nav-drag-handle:active, .oc-nav-drag-handle[aria-pressed="true"] { cursor: grabbing; background: var(--surface); }
.oc-nav-hide-toggle:hover { color: var(--amber); }
Expand Down
19 changes: 16 additions & 3 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,29 @@
.oc-nav-label::after {
content: ''; flex: 1; height: 1px; background: var(--border);
}
/* Every sidebar entry reserves a leading gutter as wide as the reorder
grip plus the row gap. Reorderable entries (Dashboard group, agents)
draw their grip inside that gutter; entries without a grip (Collaborate,
Resources, Intelligence, Admin, Help, Filters) keep it empty, so all
groups line up at the same indent (#19282). */
:root {
--oc-nav-grip-w: 1.25rem;
--oc-nav-item-gap: var(--sp-3);
--oc-nav-item-pad-x: 12px;
--oc-nav-child-inset: calc(var(--oc-nav-grip-w) + var(--oc-nav-item-gap));
}
.oc-nav-item {
display: flex; align-items: center; gap: var(--sp-3);
padding: 5px 12px; font-size: var(--fs-base); color: var(--muted);
display: flex; align-items: center; gap: var(--oc-nav-item-gap);
padding: 5px var(--oc-nav-item-pad-x) 5px calc(var(--oc-nav-item-pad-x) + var(--oc-nav-child-inset));
font-size: var(--fs-base); color: var(--muted);
cursor: pointer; text-decoration: none; border-radius: var(--r);
transition: background 0.15s, color 0.15s;
margin: 1px 8px; position: relative;
min-height: 28px; overflow: hidden;
}
.oc-nav-drag-handle, .oc-nav-hide-toggle { width: 1.25rem; height: 1.25rem; min-width: 1.25rem; padding: var(--sp-0); margin: var(--sp-0); border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--muted); line-height: 1; cursor: grab; opacity: 0; display: inline-flex; align-items: center; justify-content: center; touch-action: none; }
.oc-nav-drag-handle, .oc-nav-hide-toggle { width: var(--oc-nav-grip-w); height: var(--oc-nav-grip-w); min-width: var(--oc-nav-grip-w); padding: var(--sp-0); margin: var(--sp-0); border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--muted); line-height: 1; cursor: grab; opacity: 0; display: inline-flex; align-items: center; justify-content: center; touch-action: none; }
.oc-nav-hide-toggle { cursor: pointer; margin-left: auto; font-size: var(--fs-xs); }
.oc-nav-item > .oc-nav-drag-handle:first-child { margin-left: calc(-1 * var(--oc-nav-child-inset)); }
.oc-nav-item:hover .oc-nav-drag-handle, .oc-nav-drag-handle:focus-visible, .oc-nav-drag-handle[aria-pressed="true"], .oc-nav-item:hover .oc-nav-hide-toggle, .oc-nav-hide-toggle:focus-visible, .oc-nav-hide-toggle[aria-pressed="true"] { opacity: 1; color: var(--text); border-color: var(--border); background: var(--surface-2); outline: none; }
.oc-nav-drag-handle:active, .oc-nav-drag-handle[aria-pressed="true"] { cursor: grabbing; background: var(--surface); }
.oc-nav-hide-toggle:hover { color: var(--amber); }
Expand Down
Loading