diff --git a/CHANGES.md b/CHANGES.md index 3b24f0b8c..f410d5f94 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,7 @@ - Fix color gradient on texts [Taiga Issue #7488](https://tree.taiga.io/project/penpot/issue/7488) - Add support for self mentions [Taiga #10809](https://tree.taiga.io/project/penpot/issue/10809) - Fix team info settings alignment [Taiga #10869](https://tree.taiga.io/project/penpot/issue/10869) +- Fix left sidebar horizontal scroll on nested layers [Taiga #10791](https://tree.taiga.io/project/penpot/issue/10791) ## 2.6.2 (Unreleased) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs b/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs index c4762de28..8ab6db2d8 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs @@ -355,18 +355,14 @@ first-child-node (dom/get-first-child parent-node) subid - (when (and single? selected?) - (let [scroll-to @scroll-to-middle?] - (ts/schedule - 100 - #(when (and node scroll-node) - (let [scroll-distance-ratio (dom/get-scroll-distance-ratio node scroll-node) - scroll-behavior (if (> scroll-distance-ratio 1) "instant" "smooth")] - (if scroll-to - (dom/scroll-into-view! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"}) - (do - (dom/scroll-into-view-if-needed! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"}) - (reset! scroll-to-middle? true))))))))] + (when (and single? selected? @scroll-to-middle?) + (ts/schedule + 100 + #(when (and node scroll-node) + (let [scroll-distance-ratio (dom/get-scroll-distance-ratio node scroll-node) + scroll-behavior (if (> scroll-distance-ratio 1) "instant" "smooth")] + (dom/scroll-into-view-if-needed! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"}) + (reset! scroll-to-middle? true)))))] #(when (some? subid) (rx/dispose! subid)))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss b/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss index 0cb499359..3b83160f0 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss @@ -91,6 +91,9 @@ .element-actions { display: none; height: 100%; + display: flex; + align-items: end; + &.selected { display: flex; } diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs b/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs index 53e07b56d..6a871af6f 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs @@ -102,7 +102,8 @@ (if ^boolean edition? [:input {:class (stl/css :element-name - :element-name-input) + :element-name-input + :selected is-selected) :style {"--depth" depth "--parent-size" parent-size} :type "text" :ref ref diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_name.scss b/frontend/src/app/main/ui/workspace/sidebar/layer_name.scss index c9fbf235b..a4fb0ec05 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_name.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_name.scss @@ -11,6 +11,7 @@ @include bodySmallTypography; flex-grow: 1; color: var(--context-hover-color, var(--layer-row-foreground-color)); + &.selected { color: var(--layer-row-foreground-color-selected); } @@ -25,6 +26,7 @@ opacity: var(--context-hover-opacity, $op-7); } } + .element-name-input { @include textEllipsis; @include bodySmallTypography; @@ -37,7 +39,12 @@ border-radius: $br-8; border: $s-1 solid var(--input-border-color-focus); color: var(--layer-row-foreground-color); + + &.selected { + min-width: $s-88; + } } + .element-name-touched { color: var(--layer-row-component-foreground-color); } diff --git a/frontend/src/app/main/ui/workspace/sidebar/layers.scss b/frontend/src/app/main/ui/workspace/sidebar/layers.scss index bdcdf9168..7d1038bee 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layers.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/layers.scss @@ -226,11 +226,13 @@ display: flex; flex-direction: column; height: calc(100vh - var(--calculated-height)); - width: 100%; - overflow-x: hidden; + width: calc(var(--width) + var(--depth) * var(--layer-indentation-size)); + overflow-x: scroll; overflow-y: overlay; scrollbar-gutter: stable; + .element-list { - width: 100%; + width: var(--width); + display: grid; } } diff --git a/frontend/src/app/main/ui/workspace/sidebar/sitemap.scss b/frontend/src/app/main/ui/workspace/sidebar/sitemap.scss index 3a9a64636..4a0841e43 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/sitemap.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/sitemap.scss @@ -38,11 +38,14 @@ display: flex; flex-direction: column; height: calc(-38px + var(--height, $s-200)); - width: 100%; - overflow-x: hidden; + width: var(--width); + overflow-x: scroll; overflow-y: overlay; scrollbar-gutter: stable; - max-width: var(--width); + + .element-list { + display: grid; + } } .pages-list {