Skip to content

Avoid autofocus on mobile compose#49

Merged
rockwellll merged 2 commits into
mainfrom
codex/avoid-focus-on-mobile-and-ipad
Jun 2, 2026
Merged

Avoid autofocus on mobile compose#49
rockwellll merged 2 commits into
mainfrom
codex/avoid-focus-on-mobile-and-ipad

Conversation

@pelcasandra
Copy link
Copy Markdown
Member

@pelcasandra pelcasandra commented Jun 2, 2026

Summary

  • Prevent webchat compose autofocus on mobile and touch-first devices so opening the widget does not immediately raise the virtual keyboard.
  • Add coverage for Android, iPadOS, touch-only pointers, and the existing desktop path.

Testing

  • yarn test --runInBand
  • yarn build
  • git diff --check

Note

Low Risk
Test-only changes documenting existing compose-focus UX; no production logic in the shown diff.

Overview
Adds Jest coverage for webchat compose autofocus so opening or tapping the chat does not steal focus (and pop the virtual keyboard) on mobile and touch-first environments.

New tests assert focusCompose skips focusing the textarea when shouldAutofocusCompose is false, while still leaving the emoji picker focused. Separate cases lock in shouldAutofocusCompose for Android, iPadOS (desktop-style UA), coarse pointer + no hover, and desktop (autofocus allowed). focusCompose setup also clears document.body between runs for reliable focus assertions.

Reviewed by Cursor Bugbot for commit 2633e98. Bugbot is set up for automated code reviews on this repo. Configure here.

@rockwellll rockwellll merged commit 368a55a into main Jun 2, 2026
3 checks passed
@rockwellll rockwellll deleted the codex/avoid-focus-on-mobile-and-ipad branch June 2, 2026 12:05
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.

2 participants