Skip to content

fix(sidebar): unify the rail rule, scale rail rows, and add a compact toggle - #1606

Merged
l0gicgate merged 4 commits into
mainfrom
fix/1602-sidebar-rail-modes
Oct 13, 2026
Merged

l0gicgate merged 4 commits into
mainfrom
fix/1602-sidebar-rail-modes

Conversation

@l0gicgate

@l0gicgate l0gicgate commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

The sidebar's icon rail was decided in four places with two different thresholds: the window-only rule (preferred sidebar + one column) in the layout tick, the header toggle, and the preview's rail release, and the preview's own rule (sidebar + navigated columns + preview minimum, with hysteresis) in its split sync. Showing the sidebar in a window where only the preview rule wanted the rail opened it at full width and then snapped it back to the rail. Rail rows also kept a hard-coded 24 px minimum from CSS while the header toggle scales with the text size, so below 100 % the rail icons drifted off the toggle's axis. And the rail was purely automatic: no way to see the full sidebar in a narrow window, or to keep the rail in a wide one.

  • One fit rule. PreviewDrawer::sidebar_fit applies the preview rule whenever a preview, placeholder, or reserved Columns slot is present and the window rule otherwise; the preview tick, the header toggle, and the chooser all ask it. The separate layout tick and release_sidebar_rail are gone.
  • RailPolicy turns fit observations into an edge-triggered automatic rail: a change in fit compacts an expanded sidebar once, space that returns releases only what it compacted, and an explicit choice overrides either way. It is pure and unit-tested.
  • Rail rows, the update row, and the rail width take the scaled header-control size from code; the CSS minimums are gone.
  • The header toggle steps the sidebar through its three modes: full, then the icon rail, then hidden, then full again. Ctrl+B (and Ctrl+N in 10xer mode) take the same step, and the tooltip names the next one. The rail step persists as the new sidebar_compact preference, which existing windows bind to live; stepping from hidden to full asks for the full sidebar even where space railed it automatically, so all three modes are reachable at any width. The chooser keeps its steps for the dialog only.
  • The toggle tooltips (show, compact, hide) are localized in all eleven catalogs.

Visual evidence

Pending owner upload. Local captures (private Xvfb, Cairo renderer):

Capture Caption
evidence/before-rail-text-sizes-9-11-13-16.png Before: rail icons versus header toggle at text sizes 9, 11, 13, 16 (misaligned at 9 and 11)
evidence/after-rail-text-sizes-9-11-13-16.png After: same four sizes, icons on the toggle's axis
evidence/after-toggle-steps-720px.png After: 720 px window; automatic rail, then Ctrl+B steps hidden, full, compact, hidden
evidence/after-toggle-steps-1200px.png After: 1200 px window; Ctrl+B steps full, compact, hidden, full

How to test

  1. Open Strata in Columns and narrow the window until the sidebar rails (about 740 px at the default text size).
  2. Press Ctrl+B (or click the header toggle) four times. The sidebar hides, comes back at full width and stays there, compacts to the rail, then hides again; the toggle's tooltip names the next step each time.
  3. Widen the window with the rail showing: a rail you chose stays, an automatic one releases.
  4. In a wide window press Ctrl+B once, then open a second window: both show the rail, and sidebar_compact = true is in settings.toml. Press it twice more in either window: both hide, then both expand.
  5. Settings → Appearance: lower the text size to 9 and 11 with the sidebar railed. The rail icons sit under the header toggle.

Expected result: the sidebar never expands and snaps back; rail icons align with the toggle at every text size; one toggle reaches open, compact, and closed, and the compact step follows every window like the expanded one.

Related issue

Closes #1602

… toggle

The icon rail was decided by four callers with two thresholds, so showing
the sidebar where only the preview rule wanted the rail expanded it to
full width and then snapped it back. One fit rule now serves the preview
tick, the header toggle, and the chooser, and a pure RailPolicy turns fit
changes into an edge-triggered automatic rail that an explicit choice
overrides.

Rail rows and the update row take the scaled header-control size from
code instead of a fixed 24 px CSS minimum, so the rail icons stay under
the header toggle at every text size.

A button at the foot of the sidebar switches between the full sidebar and
the rail and persists as the new sidebar_compact preference; on an
automatic rail it expands the window's sidebar without changing the
preference, so open, compact, and closed are all reachable at any width.

Closes #1602
The toggle no longer flips visibility: a click or Ctrl+B steps the
sidebar from full to the icon rail to hidden and back, with the tooltip
naming the next step, so one control reaches every mode. The rail step
persists as sidebar_compact and the footer button is gone.

The preview's fit rule now treats an unallocated window as unknown
rather than short, and only measures the content paned's room while the
sidebar shows, so a hidden sidebar in a second window no longer rails
itself before it is first shown.
@blacksmith-sh

This comment has been minimized.

…es the step

Assistive technology and the E2E suite find the header toggle by name,
so the name stays "Toggle sidebar" in every mode and only the tooltip
announces the next step. The tenxer keyboard scenario now steps through
the rail before hiding.
@l0gicgate
l0gicgate merged commit d0f7028 into main Oct 13, 2026
12 checks passed
@l0gicgate
l0gicgate deleted the fix/1602-sidebar-rail-modes branch October 13, 2026 05:08
IKurokami added a commit to IKurokami/strata that referenced this pull request Oct 13, 2026
Apply changes from lgse/strata@d0f7028 onto the Windows fork without discarding fork commits. Includes the sidebar rail fit policy, three-state toggle, preferences, translations, documentation and tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(sidebar): rail flickers open on navigation, misaligns at small text sizes, and cannot be expanded

1 participant