Files
ontime/apps/client
Claude 752227da4c Fix Space only ever opening the navigation menu
The shortcut opened the menu but never closed it, so the only way out was
Escape or the button.

useHotkeys registers its listener once and keeps the callback it was first
given. The callback closed over the disclosure toggle, which decides its
direction from the opened value captured at that point. That value stays
false for the life of the component, so every press took the open branch
and the menu was reopened rather than closed. Instrumenting the handler
shows it firing on each press while still reporting the menu as closed,
after the component has already re-rendered with it open.

Holding the state here and toggling from the previous value removes the
dependency on the callback being current, so the shortcut works regardless.

Covered by a spec asserting the shortcut both opens and closes, and that it
closes a menu that was opened with the button. Both fail before this change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014L7R2LgjMSH2WQbiSP4uRn
2026-08-19 11:30:42 +00:00
..
2026-03-08 16:22:12 +01:00
2026-08-18 13:56:53 +02:00
2026-03-08 16:22:12 +01:00
2026-03-08 16:22:12 +01:00
2023-05-18 14:02:22 +02:00