Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): blur Pause/Resume on click so Resume actually resumes

Adam Eivy78620fbfdf48
diff --git a/client/src/components/meatspace/post/DrillTransition.jsx b/client/src/components/meatspace/post/DrillTransition.jsx
index 59806658c5..55e7c2875c 100644
--- a/client/src/components/meatspace/post/DrillTransition.jsx
+++ b/client/src/components/meatspace/post/DrillTransition.jsx
@@ -103,7 +103,17 @@ export default function DrillTransition({ nextDrillType, drillIndex, drillCount,
<div className="flex items-center gap-2">
<button
type="button"
- onClick={() => setManuallyPaused(p => !p)}
+ onClick={(e) => {
+ setManuallyPaused(p => !p);
+ // Many browsers (Chrome/Edge, Windows Firefox) keep focus on a
+ // <button> after a click, which would otherwise leave
+ // hoveringFocus=true forever — so clicking "Resume" would never
+ // actually resume (paused still true via hoveringFocus even
+ // after manuallyPaused flips off). Blur has relatedTarget=null,
+ // which the card's onBlur handler treats as "focus left the
+ // card", clearing hoveringFocus so paused can go false again.
+ e.currentTarget.blur();
+ }}
aria-pressed={manuallyPaused}
className="flex items-center gap-1.5 px-4 py-3 bg-port-card border border-port-border hover:border-port-accent text-gray-300 text-sm font-medium rounded-lg transition-colors shrink-0"
>
diff --git a/client/src/components/meatspace/post/DrillTransition.test.jsx b/client/src/components/meatspace/post/DrillTransition.test.jsx
index 35d590bf2f..561dc2ecf7 100644
--- a/client/src/components/meatspace/post/DrillTransition.test.jsx
+++ b/client/src/components/meatspace/post/DrillTransition.test.jsx
@@ -65,6 +65,29 @@ describe('DrillTransition', () => {
expect(onContinue).toHaveBeenCalledTimes(1);
});
+ it('Resume still resumes the countdown when the browser leaves focus on the button after a click', async () => {
+ // Regression: Chrome/Edge/Windows Firefox keep focus on a <button> after
+ // a real click (jsdom's fireEvent.click does not model this, which is
+ // why the previous test alone didn't catch it). Without an explicit
+ // blur-on-click, hoveringFocus would stay true forever once the
+ // Pause/Resume button is focused, permanently pausing the countdown —
+ // clicking "Resume" would never actually resume it.
+ const onContinue = vi.fn();
+ render(<DrillTransition {...baseProps} onContinue={onContinue} />);
+ const pauseButton = screen.getByRole('button', { name: 'Pause' });
+ act(() => { pauseButton.focus(); });
+ fireEvent.click(pauseButton);
+ expect(document.activeElement).not.toBe(pauseButton);
+ await tickSeconds(5);
+ expect(onContinue).not.toHaveBeenCalled();
+
+ const resumeButton = screen.getByRole('button', { name: 'Resume' });
+ act(() => { resumeButton.focus(); });
+ fireEvent.click(resumeButton);
+ await tickSeconds(3);
+ expect(onContinue).toHaveBeenCalledTimes(1);
+ });
+
it('hovering the card pauses the countdown, and un-hovering resumes it', async () => {
const onContinue = vi.fn();
const { container } = render(<DrillTransition {...baseProps} onContinue={onContinue} />);