Skip to content

[Bug]: Device panel Portrait and Landscape actions are reversed on Android tablet emulators #20177

Closed

Description

@rayonx

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included steps to reproduce and environment details.

Area

Device panel orientation controls (apps/server, Android).

Steps to reproduce

  1. Connect T3 Code to a Linux environment with an Android tablet emulator whose natural orientation is landscape.
  2. Open medium_tablet in the Device panel.
  3. Open the rotation menu and select Portrait.
  4. Select Landscape.

Expected behavior

Portrait produces a tall display. Landscape produces a wide display.

Actual behavior

The actions are reversed:

  • Portrait produces landscape, 2560 × 1600.
  • Landscape produces portrait, 1600 × 2560.

The app supports both orientations and renders correctly after rotation.

Impact

Minor bug. The requested orientation can be reached by selecting the opposite menu item.

Version or commit

T3 Code server: v0.1.0.

Environment

  • Server host: Linux Mint
  • Client: T3 Code on macOS
  • Emulator: medium_tablet, Android 15 / API 35, x86_64
  • Natural display orientation: landscape

Investigation

DeviceActions.ts uses fixed accelerometer values for the requested orientations:

portrait:        0:9.81:0
landscape_left:  9.81:0:0

On this emulator, those values produce landscape and portrait respectively. Android reports its natural landscape rotation as ROTATION_0 and portrait as ROTATION_90.

This suggests the handler assumes a portrait-native device and needs to account for the emulator's natural orientation.

Screenshot

The rotation menu used to reproduce the issue:

Device panel Portrait and Landscape menu

Workaround

Select the opposite orientation from the menu.

Activity

  1. juliusmarminge commented on Oct 16, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Confirmed on main. In apps/server/src/device/DeviceActions.ts, setOrientation maps each orientation to a fixed value and never checks the device's natural orientation:

    • Emulators get a fixed accelerometer vector (ANDROID_GRAVITY: portrait 0:9.81:0, landscape_left 9.81:0:0).
    • Other devices get cmd window user-rotation lock with fixed rotations (ANDROID_ROTATION: portrait 0, landscape_left 1).

    Both tables assume the device is portrait-native. On a device whose natural orientation is landscape, like medium_tablet, rotation 0 is landscape, so Portrait and Landscape come out swapped, which matches your report. Neither path looks up the natural orientation anywhere.

    Until this is fixed, picking the opposite menu item works.

  2. added
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions