fix(web): give the chat composer a single focus outline (UF-043)

The composer textarea drew its own focus ring inside the rounded box, which
already turns amber on focus-within. The ring is gone; the box's border stays
the focus indicator (8.14:1 dark, 4.92:1 light against the composer).
This commit is contained in:
shumeiko.it
2026-10-26 00:32:11 +01:00
parent efcb19e682
commit ae8233b8f6
3 changed files with 16 additions and 3 deletions

View File

@@ -1698,7 +1698,8 @@ const ChatApp = ({
onChange={handleInputChange}
onKeyDown={handleKeyDown}
placeholder="Reply, or ask Waggle to take the next step…"
className="min-h-[64px] max-h-[300px] flex-1 resize-none bg-transparent py-1 text-[14.5px] text-[var(--text)] placeholder:text-[var(--text-dim)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface)]"
// The surrounding box's focus-within border is the focus indicator.
className="min-h-[64px] max-h-[300px] flex-1 resize-none bg-transparent py-1 text-[14.5px] text-[var(--text)] placeholder:text-[var(--text-dim)] focus-visible:outline-none"
rows={3}
/>
<div className="flex items-center gap-2.5 pb-0.5">

View File

@@ -1018,8 +1018,10 @@ describe('ChatApp — composer input primacy', () => {
const composer = screen.getByRole('textbox', { name: /message composer/i });
expect(composer).toHaveAttribute('name', 'message');
expect(composer).toHaveAttribute('autocomplete', 'off');
expect(composer.className).toContain('focus-visible:ring-2');
expect(composer.className).toContain('focus-visible:ring-[var(--focus-ring)]');
// One focus indicator: the surrounding box's border, not a second ring on
// the textarea inside it.
expect(composer.className).not.toContain('focus-visible:ring');
expect(composer.parentElement?.className).toContain('focus-within:border-[var(--focus-ring)]');
});
it('the textarea stays enabled even while a reply streams (isLoading)', () => {

View File

@@ -71,6 +71,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
| UF-040 | The support bundle never includes recent installs | Fixed | Sidecar, support |
| UF-041 | The CLI server does not exit on Ctrl+C or SIGTERM | Fixed | Sidecar, CLI |
| UF-042 | Sidebar hints repeat the visible labels and are partly hidden behind the main area | Fixed | Web UI |
| UF-043 | The chat composer draws two focus outlines | Fixed | Web UI |
## Entries
@@ -425,3 +426,12 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
- Cause: the sidebar shows the same hints at every width, although they are only needed on the icon rail below `lg`, as a code comment already noted. The hint renders inside the nav, and the nav and `<main>` are sibling `z-10` layers, so `<main>`, later in the DOM, paints over the part of the hint that reaches into it.
- What we did: sidebar hints show only on the icon rail (`lg:hidden`) and render in `document.body` through a new opt-in `portal` flag on `HintTooltip`, so `<main>` no longer covers them. Other hints are unchanged, because several of them sit inside overlays above `z-50`, where a portaled hint would end up under the overlay. A test checks both properties.
- Recommendation: apply the same change in the main project, and review other hints that repeat a visible label.
### UF-043. The chat composer draws two focus outlines
- Status: Fixed
- Found: 2026-10-26
- Where: at commit `b20b138`, `apps/web/src/components/os/apps/ChatApp.tsx:1760` (the composer textarea), inside the box at `ChatApp.tsx:1742`
- Symptom: when the message field has focus, a square amber ring appears around the text area inside the rounded composer box, which turns amber at the same time.
- Cause: the textarea has its own `focus-visible:ring-2` while its box already shows focus with `focus-within:border-[var(--focus-ring)]` and a glow.
- What we did: removed the ring from the textarea. The box's border stays the single focus indicator; it measures 8.14:1 against the composer in the dark theme and 4.92:1 in the light theme. The composer test now checks for one indicator.
- Recommendation: apply the same change in the main project.