Commit 48335e1
fix(ui): add border between live preview window and document fields (#16793)
## What changed
Adds a visual border separating the Live Preview window from the
document fields panel, and fixes two edge cases where the border was
either missing or doubled.
## Why
### Case 1: Collections with sidebar fields — border appeared fine (but
for the wrong reason)
When a collection has sidebar fields, `document-fields--has-sidebar`
sets `--main-border` on `document-fields__edit`, which draws a
`border-right` between the main fields and the sidebar. This border
happened to visually separate the document from the live preview window
too — but only because the layout stacked them adjacently. It wasn't an
intentional live-preview border.
### Case 2: Collections without sidebar fields — border was missing
When there are no sidebar fields (or the sidebar fields are empty),
`--main-border` resolves to `none`, so no divider was drawn at all. When
live preview was active, the iframe just appeared flush against the
document fields with no visual separation.
### Case 3: With sidebar fields + live preview active — double border
When live preview is active, `forceSidebarWrap` is set on
`DocumentFields`, which applies the
`.document-fields--force-sidebar-wrap` class. However, `--main-border`
was still in effect from `--has-sidebar`, meaning the sidebar's
`border-right` and any new live-preview border would both render —
creating a 2px thick border.
### Case 4: Expanded (full-width) live preview — border next to nav
When the live preview is expanded to 100% width, its `border-left` sat
right next to the nav's `border-right`, producing a doubled border there
too.
## Fix
- Added `border-left: var(--stroke-width-small) solid
var(--color-border)` to `.live-preview-window--is-live-previewing` —
this is the single source of truth for the live-preview divider.
- Added `--main-border: none` to `.document-fields--force-sidebar-wrap`
(which is only applied when live preview is active) to prevent the
sidebar's `border-right` from doubling up.
- Added `border-left: none` to `.live-preview-window--is-expanded` so
the border disappears when expanded to full width (where it would clash
with the nav border).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent bb110a6 commit 48335e1
2 files changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
0 commit comments