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): open the "?" explanation on hover only, not on click

Eren5e76fa25fddb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 65f660d..41fb6f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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.
+- A setting's "?" explanation now appears on hover or keyboard focus, floating over the settings, instead of opening on a click inside the row and pushing the rest of the list down.
## [0.15.0] - 2026-10-27
### Added
diff --git a/packages/template/src/SettingsModal.tsx b/packages/template/src/SettingsModal.tsx
index 3632101..b17f7f4 100644
--- a/packages/template/src/SettingsModal.tsx
+++ b/packages/template/src/SettingsModal.tsx
@@ -20,42 +20,39 @@ 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". 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.
+ * modal while the pointer rests on the "?" or the keyboard focuses it, so
+ * nothing below it moves; there is nothing to click. Escape closes it.
*/
function FieldDetails({ id, field }: { id: string; field: SettingField }) {
const [hovered, setHovered] = useState(false);
- const [pinned, setPinned] = useState(false);
- const open = hovered || pinned;
+ const [focused, setFocused] = useState(false);
+ const open = hovered || focused;
const detailId = `${id}-details`;
return (
<span
className="settings-why-wrap"
onMouseEnter={() => setHovered(true)}
- onMouseLeave={() => {
- setHovered(false);
- setPinned(false);
- }}
+ onMouseLeave={() => setHovered(false)}
>
- <button
- type="button"
+ <span
className="settings-why"
- aria-expanded={open}
- aria-describedby={open ? detailId : undefined}
+ // Focusable so the keyboard reaches the explanation too.
+ tabIndex={0}
+ role="img"
aria-label={`What does ${field.label} do?`}
- onFocus={() => setPinned(true)}
- onBlur={() => setPinned(false)}
- onClick={() => setPinned((wasPinned) => !wasPinned)}
+ aria-describedby={open ? detailId : undefined}
+ onFocus={() => setFocused(true)}
+ onBlur={() => setFocused(false)}
onKeyDown={(event) => {
if (event.key !== "Escape" || !open) return;
// Close the bubble, not the modal around it.
event.stopPropagation();
setHovered(false);
- setPinned(false);
+ setFocused(false);
}}
>
?
- </button>
+ </span>
{open ? (
<span className="settings-details" id={detailId} role="tooltip">
{field.details}
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index fdcd4d4..e613553 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -639,6 +639,10 @@ ul {
/* The "?" behind a setting's plain-language explanation (Story 12.1). */
.settings-why {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
width: 18px;
height: 18px;
padding: 0;
@@ -649,10 +653,11 @@ ul {
font: inherit;
font-size: 11px;
line-height: 1;
- cursor: pointer;
+ cursor: help;
}
-.settings-why[aria-expanded="true"] {
+.settings-why-wrap:hover .settings-why,
+.settings-why:focus-visible {
color: var(--text);
border-color: var(--muted);
}