Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Typing into the Device panel's simulator goes to the chat composer, and returning to the window refocuses the composer #19488

ClosedJaiiR320(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a thread, open the right panel, choose Device, and start an iOS simulator.
  2. Click the simulator screen, then tap a text field on the device, such as Spotlight's Search field on the home screen.
  3. Type hello on the computer keyboard.
  4. Separately, with the simulator screen focused, leave the T3 Code window and come back to it.

Expected behavior

Typed text goes to the device's text field, and focus stays on the simulator screen. Coming back to the window leaves focus on the simulator screen.

Actual behavior

hello appears in the chat composer, the device field stays empty, and focus moves to the composer. Backspace, Enter, and the arrow keys still reach the device; only printable characters are redirected.

Coming back to the window also moves focus from the simulator screen to the composer, so the next keystrokes go to the composer too. We triggered this by dispatching blur and focus on window, which is the event the window focus handler listens for.

Impact

Major degradation or frequent failure

Version or commit

upstream main @ 7ac952c630

Environment

macOS 26.3, web client (vp run dev) in T3 Code's Browser panel, iPhone 16 Pro simulator on iOS 26.5

Investigation

The device screen in DeviceStreamView is a focusable [role="application"] element that forwards keys to the device. Two window-level paths in the chat view don't treat it as something that owns keyboard input:

  • Type-to-focus and paste-to-focus (shouldRedirectInputToComposer in apps/web/src/components/ChatView.tsx) skip editable and interactive elements. [role="application"] is in neither list, so printable keys are captured and redirected into the composer.
  • Window refocus moves focus to the composer unless shouldRefocusComposerOnWindowFocus (apps/web/src/components/ChatView.logic.ts) sees a text field, iframe or webview, terminal, dialog, or popup. The device screen isn't on that list.

Open PR #14534 adds [role="application"] to the type-to-focus interactive selector. That covers typing, but the window refocus path is still present on main.

We have a local fix that excludes [role="application"] from both paths, with a unit test for the refocus case. On the iOS simulator, typing reaches the device and focus survives a window blur and focus. Typing, pasting, and window refocus elsewhere in the chat view still land in the composer. With that fix, pasting while the device screen is focused does nothing, because the device screen doesn't forward paste today.

We're reporting this first so maintainers can confirm the intended behavior and scope, and we're happy to open a PR.

Screenshots, recordings, or supporting files

Before recording (upstream main): tapping Spotlight Search on the simulator, then typing hello, sends the text to the composer.

https://github.com/user-attachments/assets/ffd88765-686d-45b5-87a9-a788b85962f2

  1. Note

    Grok responding on behalf of Julius.

    Confirmed on main. This is a bug, and it has two parts. The device screen in DeviceStreamView is a focusable [role="application"] element, and neither window-level focus path treats it as owning keyboard input:

    • Type/paste-to-focus: TYPE_TO_FOCUS_INTERACTIVE_SELECTOR in ChatView.tsx doesn't include [role="application"]. Open PR #14534 adds it, which fixes the typing part only.
    • Window refocus: shouldRefocusComposerOnWindowFocus in ChatView.logic.ts skips inputs, iframes/webviews, textboxes, dialogs, popups and terminals, but not [role="application"]. So coming back to the window still takes focus from the simulator. #14534 doesn't touch this.

    You're welcome to open your combined PR. Please cover both paths and include the refocus unit test, and mention #14534 so the overlap is easy to see in review. Opening a PR doesn't guarantee it gets merged. Paste doing nothing while the device screen is focused is fine for now.

  2. juliusmarminge added labelsaccepted

  3. juliusmarminge added labelsbug

  4. juliusmarminge added labelsvia-triage

  5. juliusmarminge closed this

Sign in to join this conversation.