fix(diagnostics): clamp desktop toast to viewport, wrap long tokens#343
Conversation
Desktop .toast-diagnostic (min-width:280px/max-width:400px, top-right via #diagnostic-toast-container) had no guarantee against exceeding the right viewport edge, and .toast-diagnostic-msg lacked overflow-wrap:anywhere, so long unbreakable identifiers (hook event names, absolute paths) forced the box's intrinsic width past the container's right offset and clipped off-screen. - max-width: min(400px, calc(100vw - 16px)) keeps the box on-screen at any desktop viewport width while preserving the 400px intent and top-right placement. - overflow-wrap: anywhere on .toast-diagnostic-msg mirrors the existing mobile fix (lr-4ef618) so long tokens wrap instead of forcing overflow. Desktop-only change; the @media (max-width: 768px) block (lr-4ef618) is untouched. Verified via test/diagnostic-format-lr-8294.test.js (tests 164, 176-179 all still pass). tests_passed: null (npm test has a pre-existing unrelated failure in test/sdk-bridge-context-window-warn.test.js, lr-1f7e, reproduced identically on unmodified main — not touched by this change)
PEACHES — clean (0 nits)No blocking findings. The fix precisely addresses task lr-fab390: desktop diagnostic toasts can no longer clip off the right viewport edge. Summary
All three changes are minimal, well-placed, and follow the mobile precedent pattern exactly. |
|
Reviewed PR #343 (fix(diagnostics): clamp desktop toast to viewport, wrap long tokens). Diff scope: lib/public/css/diagnostics.css only (+14/-1, CSS-only per assignment). Changes: max-width clamped via min(400px, calc(100vw - 16px)) with box-sizing: border-box added to the .toast-diagnostic container, and overflow-wrap: anywhere added alongside existing word-break: break-word on the message text. No secrets, no dependency manifest changes, no SAST-relevant sinks (no innerHTML/DOM injection/URL construction) — pure presentational CSS. gitleaks and semgrep both ran clean on the changed file; osv-scanner not applicable (no dependency manifest touched). Early-exit lane: low-surface diff, no reachable security sink. NOTE: the assignment-supplied head_sha (c62627d) is 41 hex characters, one longer than a standard 40-char git SHA-1 — flagging this anomaly; stamped verbatim as supplied since no sanctioned path exists to independently resolve the correct value. |
|
Merged via clagentic-loadout v0.1.0
|
What
Fix the diagnostic WARNING toast clipping off the right edge of the viewport on desktop.
Root cause
In lib/public/css/diagnostics.css, desktop .toast-diagnostic (min-width:280px/max-width:400px, top-right positioned via #diagnostic-toast-container) had no clamp against the right viewport edge, and .toast-diagnostic-msg lacked overflow-wrap: anywhere (only had word-break: break-word). Long unbreakable identifiers (hook event names like SubagentStart/UserPromptSubmit, absolute paths) forced the box intrinsic width past the container right offset, clipping the toast off-screen.
This mirrors the mobile-only fix in lr-4ef618 (PR #335), which explicitly scoped desktop out. This PR addresses the desktop path.
Fix
Scope: lib/public/css/diagnostics.css only, desktop rules (outside the @media max-width:768px block). The mobile block is untouched, verified by diff and by test 179 (mobile media query keeps top-anchor behavior) still passing.
Confirmed no toast-container structural assumption in docs/guides/architecture.md (read in full).
Out of scope
Tests
npm test run. All diagnostics.css/diagnostic-toast tests pass (164, 176-179, and the full diagnostic-format-lr-8294.test.js suite).
One pre-existing, unrelated failure: test/sdk-bridge-context-window-warn.test.js (lr-1f7e, context-window warn toast gating), reproduced identically on a clean unmodified main checkout before this change, confirming it is not caused by this diff.
Task: lr-fab390