Skip to content

fix(app): disable touch composer on desktop - #67612

Merged
Hona merged 1 commit into
devfrom
desktop-touch-composer
Dec 1, 2026
Merged

Hona merged 1 commit into
devfrom
desktop-touch-composer

Conversation

@Hona

@Hona Hona commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Disables the mobile touch composer dock in the Electron desktop app so Windows desktops, 2-in-1s, and remote desktop sessions keep the desktop toolbar and Enter-to-send.

Fixes #62647

Cause

On Windows, Chromium's GetAvailablePointerAndHoverTypesImpl() (ui/base/pointer/pointer_device_win.cc) reports (hover: none) and (pointer: coarse) in two common desktop setups:

flowchart LR
  W[Windows Electron] --> T{IsDeviceUsedAsATablet?}
  T -- yes --> C["(hover: none) & (pointer: coarse)<br/>skips SM_MOUSEPRESENT"]
  T -- no --> M{SM_MOUSEPRESENT == 0<br/>& virtual touch?}
  M -- yes --> C
  C --> D[Touch dock + Enter = newline]
Loading
  • Slate-mode short-circuit: Touch-capable 2-in-1s (e.g. Surface with a Bluetooth keyboard/trackpad, ThinkPad X12 Detachable) and Wacom pen displays report SM_CONVERTIBLESLATEMODE == 0, causing Chromium to return {POINTER_TYPE_COARSE, HOVER_TYPE_NONE} without checking SM_MOUSEPRESENT.
  • Remote desktop without a physical mouse: Headless desktops accessed over RDP can report SM_MOUSEPRESENT == 0 alongside a virtual touch digitizer (NID_EXTERNAL_TOUCH).

Change

  • Gate the composer's touch media query in packages/app/src/composer/editor/editor.tsx behind platform.platform !== "desktop" so only the web app switches to the touch dock:
const touch = platform.platform === "desktop" ? () => false : createMediaQuery("(hover: none) and (pointer: coarse)")

Added by the opencode bot (AI-generated).

Related: #43088

Copilot AI balanced review requested due to automatic review settings December 1, 2026 22:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works. I made Desktop report a touch screen by turning on Chromium's touch emulation, so (hover: none) and (pointer: coarse) matches. On the base branch the composer switched to the touch dock and used enterkeyhint="enter". With this PR, Desktop keeps the regular composer with its toolbar and inline send button, while the web app still uses the touch composer. I couldn't test on real Windows hardware or over remote desktop; the emulation produces the same query result described in the issue.

The type check and the composer tests in packages/app pass.

Public API: unchanged.

No blocking concerns.

Related: #43088

Before

After

@Hona
Hona merged commit 40ce89c into dev Dec 1, 2026
13 checks passed
@Hona
Hona deleted the desktop-touch-composer branch December 1, 2026 22:38
@amrkmn amrkmn mentioned this pull request Dec 3, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feedback on the desktop versions ui (windows)

2 participants