Three things that said one thing and did another

All three shipped in the last two commits, and all three are the same kind of
mistake: an interface that looks right and is not.

The folder settings page could not be scrolled. `.main` is a flex column with
`min-height: 0`, so a `.page` dropped straight into it overflows the viewport
with nothing to scroll -- Save and Back end up below the bottom of the window,
reachable by zooming out or by dragging the prompt textarea up out of the way.
Every other page of this shape already wraps its content in `.admin-scroll`;
this one did not. The two class names that scroll are one rule in admin.css
precisely so this is a wrapper somebody forgot rather than a value they got
wrong, and now it is noted.

The project directory was a text box, on the one screen that asks for an
absolute path on another machine. It is the same button-and-hidden-field the
new-chat screen uses, wired by `[data-dir-field]` in ui.js -- scoped to that
attribute so this and the composer's own handler cannot both answer one click
and open two dialogs. The composer keeps its own because it does more: it
follows the selected profile's default directory until somebody picks their
own, which only means something while a chat is being created. With no
connection chosen it says so rather than opening onto nothing, and Clear is
always there, because browsing somewhere and changing your mind before saving
needs a way back to "no opinion" as much as clearing a saved one does.

And "New chat" did not follow the Chat/Agent switch. The button sits above the
scroll area rather than inside the tree the switch swaps, so it went on saying
"New chat" over a list of agent chats. It moves to its own partial and arrives
out of band, the way the chat title already does. Renaming it to something
neutral would have hidden the bug rather than fixed it, and would have cost the
`?kind=agent` preselection the label is there to explain.

The tests that existed asserted a page load, which re-renders the button
anyway -- which is exactly why nobody saw it. The new ones assert the fragment.
The directory field was driven under a DOM stub first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaroslav Beneš
2026-08-04 10:40:01 +02:00
parent fd4db76c64
commit a56ee16ee3
10 changed files with 263 additions and 33 deletions
+36 -5
View File
@@ -39,6 +39,14 @@
</a>
</header>
{#
`.admin-scroll` is what scrolls, not `.page`. `.main` is a flex column
with `min-height: 0`, so a `.page` dropped straight into it overflows the
viewport with nothing to scroll -- Save and Back end up somewhere below
the bottom of the window, reachable only by zooming out. Every other page
of this shape already wraps its content this way; this one did not.
#}
<div class="admin-scroll">
<div class="page">
<form hx-patch="/api/folders/{{ folder.id }}" hx-swap="none">
<div class="card">
@@ -128,11 +136,33 @@
</select>
</div>
<div class="field">
<label class="field__label" for="folder-dir">Project directory</label>
<input class="input input--mono" type="text" id="folder-dir" name="project_dir"
maxlength="1000" value="{{ folder.project_dir }}"
placeholder="The connection's own default.">
{# A button and a hidden field, not a text box -- the same shape the
new-chat screen uses, and for the same reason it gives there: a
path is something you would rather find than spell. `data-dir-field`
is what wires it; see ui.js. #}
<div class="field" data-dir-field>
<span class="field__label">Project directory</span>
<input type="hidden" name="project_dir"
value="{{ folder.project_dir }}" data-dir-value>
<div class="dir-row">
<button class="btn" type="button" data-dir-browse
aria-label="Choose the project directory">
{{ icon("folder", "icon--sm") }}
<span class="dir-row__path" data-dir-label>
{{ folder.project_dir or "the connection's own default" }}
</span>
</button>
{# Always here, not only when something is stored: browsing to a
directory and then changing your mind before saving needs a way
back to "no opinion" as much as clearing a saved one does. #}
<button class="btn btn--icon" type="button" data-dir-clear
aria-label="Clear the project directory" title="No opinion">
{{ icon("x", "icon--sm") }}
</button>
</div>
<p class="field__hint">
What a relative path is measured from in chats started here.
</p>
</div>
{% if agent_modes %}
@@ -158,6 +188,7 @@
</div>
</form>
</div>
</div>
</main>
</div>
{% endblock %}