mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 09:08:54 -04:00
The chat settings sheet, the Talk session sheet and the agent and task preview sheets set up their focus handling in an effect that depended on onClose. Every parent passes onClose as an inline arrow, so each re-render of the page gave it a new identity: the effect cleanup sent focus back to the opener and the effect ran again and focused the Close button. Any edit in a sheet re-renders the page, so focus left the control being used. In the chat sheet, typing in the system prompt moved focus to Close after the first key, and a following space activated Close and dismissed the sheet; an open native dropdown in the sheet closed by itself. Keep the latest onClose in a ref and run the focus effect once per open. Escape still calls the current onClose; initial focus on Close, the Tab trap and restoring focus to the opener are unchanged. The e2e specs type key by key (or switch preview tabs) and assert that focus stays put; they fail without this change. Docs-Not-Needed: bug fix, no user-facing behaviour change beyond the fix Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>