Chapter 17

Mobile

17.1 Built-in behaviour#

Concern How PixiFormUI handles it
Scroll versus tap Controls act on tap. A swipe that starts on a field scrolls instead of focusing it, so the keyboard doesn't pop up mid-scroll.
On-screen keyboard FormUI sizes the host to visualViewport (fitVisualViewport: true), and ScrollView keeps the focused field visible above the keyboard.
Keyboard type inputMode and enterKeyHint on text fields; password fields switch the proxy to type=password.
Obscured typing Last character shown briefly on touch devices (revealLastChar: 'auto').
IME and composition CJK input, swipe keyboards, autocorrect commits and Android backspace are all handled by the proxy.
Zoom and callouts The proxy uses a 16px font (no iOS zoom-on-focus); touch-action: none, no long-press callout, no overscroll bounce.
Performance Render resolution capped at 2×; only visible text lines are rendered; animations stop when idle.
Responsive layout Row(..., breakpoint) stacks into one column on narrow screens.

17.2 Design tips#

17.3 Testing on a real phone#

Two constraints apply: the server only answers allowed host names, and Web Crypto (needed for PFE1) only works in a secure context. A plain http://192.168.x.x URL fails both. Options, best first:

  1. USB port forwarding (the phone sees localhost, which counts as a secure context):
    • Android: adb reverse tcp:8787 tcp:8787, then open http://localhost:8787 in Chrome on the phone.
    • iOS: use Safari Web Inspector with a tunnel (option 2).
  2. HTTPS tunnel, e.g. Cloudflare Tunnel or ngrok:
    cloudflared tunnel --url http://localhost:8787          # prints https://<random>.trycloudflare.com
    EXTRA_ALLOWED_HOSTS=<random>.trycloudflare.com npm run dev
    
    Hot reload over the tunnel may not connect (the dev CSP only allows local WebSockets); reload manually.

17.4 Emulating in desktop Chrome#

DevTools → device toolbar → choose a phone. Touch emulation sets (pointer: coarse), so tap semantics and revealLastChar: 'auto' behave as on a phone.