fix(app): keep the mobile drawer open while a session loads (#59427)

This commit is contained in:
Kit Langton
2026-10-29 19:39:54 -07:00
committed by GitHub
Unverified
parent bbd853506e
commit 50ea8d5003
@@ -62,8 +62,14 @@ export function createSessionComposerController(input: {
if (!editor?.isConnected || !region.showComposer() || region.child() || dialog.active) return
const active = document.activeElement
// A control chosen while the session was loading owns focus now.
if (active && active !== document.body && active !== editor && !active.matches("[data-titlebar-tab-link]"))
// A control chosen while the session was loading owns focus now. The tab link that opened the session
// passes focus on, unless it sits in a dialog, such as the mobile tabs drawer reopened before the composer.
if (
active &&
active !== document.body &&
active !== editor &&
(!active.matches("[data-titlebar-tab-link]") || active.closest('[role="dialog"]'))
)
return
editor.focus({ preventScroll: true })
setCursorPosition(editor, adapter.state.cursor() ?? promptLength(adapter.state.current()))