fix: sidebar hiding works again

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-26 06:51:41 +02:00
parent 8258b044b1
commit 82ba43c7ba
2 changed files with 17 additions and 2 deletions

View File

@@ -90,7 +90,7 @@
<section
class={["sidebar-shell", if(not @workbench.sidebar_visible, do: "is-hidden")]}
data-testid="sidebar-shell"
style={"width: #{@workbench.sidebar_width}px;"}
style={"width: #{if(@workbench.sidebar_visible, do: @workbench.sidebar_width, else: 0)}px;"}
>
<div class="sidebar" data-region="sidebar">
<div id="sidebar-content" class="sidebar-content sidebar-body" phx-hook="SidebarInteractions">
@@ -307,7 +307,7 @@
<section
class={["assistant-sidebar-shell", if(not @workbench.assistant_sidebar_visible, do: "is-hidden")]}
data-testid="assistant-shell"
style={"width: #{@workbench.assistant_sidebar_width}px;"}
style={"width: #{if(@workbench.assistant_sidebar_visible, do: @workbench.assistant_sidebar_width, else: 0)}px;"}
>
<div class="resizable-panel-divider assistant-divider" data-resize="assistant" data-role="resize-handle"></div>
<aside class="assistant-sidebar" data-region="assistant-sidebar">

View File

@@ -154,4 +154,19 @@ defmodule BDS.Desktop.ShellLiveTest do
html = render_keydown(view, "shortcut", %{key: "w", meta: true})
refute html =~ ~s(data-tab-id="media-1")
end
test "hiding the sidebar collapses its width to zero" do
{:ok, view, html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)
assert html =~ ~s(data-testid="sidebar-shell")
assert html =~ ~s(style="width: 280px;")
html =
view
|> element("[data-testid='toggle-sidebar']")
|> render_click()
assert html =~ ~s(class="sidebar-shell is-hidden")
assert html =~ ~s(style="width: 0px;")
end
end