Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

fix(settings): float the "?" explanation instead of pushing rows down

Eren39c7dcecb192
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f2ad52..65f660d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- What the detached hook runs (the map build, the side model) print goes to `.cogit/state/detached.log` (local, never committed, starts over past 256 KB); a failed side run used to leave no trace.
+### Changed
+- A setting's "?" explanation now floats over the settings on hover, keyboard focus or tap, instead of opening inside the row and pushing the rest of the list down.
+
## [0.15.0] - 2026-10-27
### Added
- Recording modes (`recorder`): `mixed` (the default) records with a small side model every `sideEveryTurns` turns outside the chat and asks the main agent every `updateEveryTurns`; `agent` keeps the agent writing its own record; `side` never interrupts the agent. The side model runs detached behind the session lock, writes message nodes, titles, parents and user decisions, and never overwrites a field the main agent wrote (per-field ownership, and the agent's parent corrections survive later side runs). `sideModel` (renamed from `catchUpModel`, which is still read and migrated) names the model. Every setting gains a "?" in the panel with a plain-language explanation — what it does, when to change it, what it costs — and `cogit config --help` prints the same text.
diff --git a/packages/template/src/SettingsModal.tsx b/packages/template/src/SettingsModal.tsx
index 8060598..3632101 100644
--- a/packages/template/src/SettingsModal.tsx
+++ b/packages/template/src/SettingsModal.tsx
@@ -19,30 +19,49 @@ type SettingValue = PanelSettings[keyof PanelSettings];
/**
* The "?" next to a setting's label (Story 12.1): a plain-language answer to
- * "what is this, when do I change it, what does it cost", closed by default so
- * the modal stays short.
+ * "what is this, when do I change it, what does it cost". It floats over the
+ * modal on hover or keyboard focus, so nothing below it moves; a tap pins it on
+ * a touch screen, and Escape or leaving closes it.
*/
function FieldDetails({ id, field }: { id: string; field: SettingField }) {
- const [open, setOpen] = useState(false);
+ const [hovered, setHovered] = useState(false);
+ const [pinned, setPinned] = useState(false);
+ const open = hovered || pinned;
const detailId = `${id}-details`;
return (
- <>
+ <span
+ className="settings-why-wrap"
+ onMouseEnter={() => setHovered(true)}
+ onMouseLeave={() => {
+ setHovered(false);
+ setPinned(false);
+ }}
+ >
<button
type="button"
className="settings-why"
aria-expanded={open}
- aria-controls={detailId}
+ aria-describedby={open ? detailId : undefined}
aria-label={`What does ${field.label} do?`}
- onClick={() => setOpen((wasOpen) => !wasOpen)}
+ onFocus={() => setPinned(true)}
+ onBlur={() => setPinned(false)}
+ onClick={() => setPinned((wasPinned) => !wasPinned)}
+ onKeyDown={(event) => {
+ if (event.key !== "Escape" || !open) return;
+ // Close the bubble, not the modal around it.
+ event.stopPropagation();
+ setHovered(false);
+ setPinned(false);
+ }}
>
?
</button>
{open ? (
- <p className="settings-details" id={detailId}>
+ <span className="settings-details" id={detailId} role="tooltip">
{field.details}
- </p>
+ </span>
) : null}
- </>
+ </span>
);
}
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index 70ca4d4..fdcd4d4 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -657,12 +657,29 @@ ul {
border-color: var(--muted);
}
+.settings-why-wrap {
+ position: relative;
+ display: inline-flex;
+}
+
+/* Floats below the "?" so opening it never pushes the rows around. */
.settings-details {
- max-width: 46ch;
- margin: 6px 0 0;
+ position: absolute;
+ top: calc(100% + 6px);
+ left: -8px;
+ z-index: 5;
+ width: max-content;
+ max-width: min(46ch, calc(100vw - 64px));
+ padding: 8px 10px;
color: var(--text);
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ box-shadow: 0 6px 20px rgb(0 0 0 / 18%);
font-size: 12px;
+ font-weight: normal;
line-height: 1.5;
+ white-space: normal;
}
.settings-help {