Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/app/src/session/composer/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
Loading