mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 14:14:17 +00:00
752227da4c
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