|
| 1 | +--- |
| 2 | +id: task-025 |
| 3 | +title: Investigate iOS simulator viewport regression - content shifted up |
| 4 | +status: Done |
| 5 | +assignee: |
| 6 | + - '@claude' |
| 7 | +created_date: '2026-01-05 17:36' |
| 8 | +updated_date: '2026-01-06 16:24' |
| 9 | +labels: |
| 10 | + - ios |
| 11 | + - bug-investigation |
| 12 | + - viewport |
| 13 | +dependencies: [] |
| 14 | +priority: medium |
| 15 | +--- |
| 16 | + |
| 17 | +## Description |
| 18 | + |
| 19 | +<!-- SECTION:DESCRIPTION:BEGIN --> |
| 20 | +The iOS simulator (iPhone 13 mini) shows content shifted toward the top of the screen with excessive empty white space at the bottom. The main content (LUNCH logo, radio buttons, Roll Lunch button) is vertically imbalanced. |
| 21 | + |
| 22 | +Need to determine if this is: |
| 23 | +1. A simulator-only visual artifact |
| 24 | +2. A real regression that affects physical iOS devices |
| 25 | +3. A CSS/layout issue introduced in recent changes |
| 26 | + |
| 27 | +Reference screenshots: |
| 28 | +- Simulator: /Users/lance/Desktop/Simulator Screenshot - iPhone 13 mini - 2026-01-05 at 11.23.10.png |
| 29 | +- Comparison: /Users/lance/Desktop/Screenshot 2026-01-05 at 11.24.13 AM.jpeg |
| 30 | +<!-- SECTION:DESCRIPTION:END --> |
| 31 | + |
| 32 | +## Acceptance Criteria |
| 33 | +<!-- AC:BEGIN --> |
| 34 | +- [x] #1 Tested on physical iOS device to confirm if issue reproduces |
| 35 | +- [x] #2 Compared viewport behavior between simulator and real device |
| 36 | +- [x] #3 Root cause identified (simulator bug vs actual regression) |
| 37 | +- [x] #4 If regression: fix implemented and verified on both simulator and device |
| 38 | +- [ ] #5 If simulator-only: documented as known simulator quirk |
| 39 | +<!-- AC:END --> |
| 40 | + |
| 41 | +## Implementation Plan |
| 42 | + |
| 43 | +<!-- SECTION:PLAN:BEGIN --> |
| 44 | +1. Analyze current CSS layout logic for vertical centering |
| 45 | +2. Check git history for recent CSS changes that might have caused regression |
| 46 | +3. Test on physical device via `task ios:device` to confirm issue reproduces (AC #1, #2) |
| 47 | +4. Compare layout behavior between simulator and device |
| 48 | +5. Identify root cause (AC #3) |
| 49 | +6. Fix if regression, document if simulator-only quirk (AC #4 or #5) |
| 50 | +<!-- SECTION:PLAN:END --> |
| 51 | + |
| 52 | +## Implementation Notes |
| 53 | + |
| 54 | +<!-- SECTION:NOTES:BEGIN --> |
| 55 | +- Fixed Xcode build PATH issue: npm not found because Xcode's restricted PATH doesn't include mise shims |
| 56 | +- Solution: Modified `src-tauri/gen/apple/lunch.xcodeproj/project.pbxproj` shellScript to prepend `$HOME/.local/share/mise/shims` to PATH |
| 57 | +- iOS simulator build now succeeds |
| 58 | + |
| 59 | +- Analyzed CSS layout: `.main-content` has `justify-content: center` but content appears top-aligned on iOS simulator |
| 60 | +- Root cause hypothesis: iOS WKWebView doesn't handle `height: 100%` correctly for viewport calculations |
| 61 | +- CSS Fix applied: Added `min-height: 100dvh` to `.app-container` with `@supports` for `100svh` (small viewport height for iOS) |
| 62 | +- iOS simulator build succeeds with the fix |
| 63 | +- **NEEDS TESTING**: User should verify on simulator and physical device to confirm fix |
| 64 | + |
| 65 | +**Physical Device Install Error:** |
| 66 | + |
| 67 | +Attempted to test on physical iPhone 13 mini (iPhone14,4, iOS 18.7.1) but installation failed with entitlement error: |
| 68 | + |
| 69 | +``` |
| 70 | +Unable to Install "Lunch" |
| 71 | +Domain: IXUserPresentableErrorDomain |
| 72 | +Code: 14 |
| 73 | +Recovery Suggestion: Failed to install embedded profile for com.lunch.desktop : 0xe800801f (Attempted to install a Beta profile without the proper entitlement.) |
| 74 | +``` |
| 75 | + |
| 76 | +Error details: |
| 77 | +- MIInstallerErrorDomain Code 13 |
| 78 | +- LibMISErrorNumber: -402620385 |
| 79 | +- ApplicationVerificationFailed: "This app cannot be installed because its integrity could not be verified" |
| 80 | +- Root cause: Missing entitlement for beta/development profile installation |
| 81 | + |
| 82 | +Blocking: Cannot test viewport fix on physical device until provisioning/entitlement issue is resolved |
| 83 | + |
| 84 | +Environment: |
| 85 | +- macOS 15.7.1 (Build 24G231) |
| 86 | +- Xcode 16.4 (23792) |
| 87 | +- Device: iPhone 13 mini, iOS 18.7.1 (22H31) |
| 88 | + |
| 89 | +**Provisioning Fix Applied:** |
| 90 | +- User opened Xcode and enabled "Automatically manage signing" |
| 91 | +- Logged into Apple Developer account |
| 92 | +- Entitlement error resolved |
| 93 | + |
| 94 | +**New Error: WebSocket Connection Refused** |
| 95 | +``` |
| 96 | +failed to read CLI options: Context("failed to build WebSocket client", Io(Os { code: 61, kind: ConnectionRefused })) |
| 97 | +``` |
| 98 | + |
| 99 | +**Root Cause:** Building directly from Xcode instead of using CLI. |
| 100 | + |
| 101 | +**Correct Workflow:** |
| 102 | +1. NEVER build directly from Xcode's Build button |
| 103 | +2. ALWAYS use `task ios:device` from terminal |
| 104 | +3. This starts the Tauri dev server (WebSocket) → then opens Xcode → Xcode builds with server running |
| 105 | + |
| 106 | +The Tauri iOS dev workflow requires the CLI to start a WebSocket server that Xcode's build script connects to for passing configuration. |
| 107 | + |
| 108 | +**WebKit Sandbox Fix Applied:** |
| 109 | + |
| 110 | +Root cause: WKWebView on physical iOS devices requires explicit sandbox extension to read app bundle files. The strictly sandboxed webview process fails without App Groups entitlement. |
| 111 | + |
| 112 | +Fixes applied: |
| 113 | +1. `src-tauri/Info.ios.plist` - Added NSAppTransportSecurity with NSAllowsArbitraryLoads and NSLocalNetworkUsageDescription |
| 114 | +2. `src-tauri/gen/apple/lunch_iOS/lunch_iOS.entitlements` - Added App Groups entitlement (group.com.lunch.desktop) |
| 115 | + |
| 116 | +**MANUAL STEP REQUIRED:** |
| 117 | +User must register the App Group in Apple Developer Portal: |
| 118 | +1. Go to https://developer.apple.com/account/resources/identifiers/list/applicationGroup |
| 119 | +2. Click + to add new App Group |
| 120 | +3. Enter: `group.com.lunch.desktop` |
| 121 | +4. In Xcode, go to Signing & Capabilities > + Capability > App Groups |
| 122 | +5. Enable the `group.com.lunch.desktop` group |
| 123 | + |
| 124 | +Then rebuild: `task ios:device` |
| 125 | + |
| 126 | +**Corrected command:** `task ios:dev:device` (not `task ios:device`) |
| 127 | + |
| 128 | +**Resolution:** |
| 129 | + |
| 130 | +- Tauri iOS dev mode has WebKit sandbox issues on physical devices |
| 131 | +- Release builds work correctly - bundled assets avoid dev server network/sandbox complications |
| 132 | +- Created new task `task ios:run:device` that builds release and installs via devicectl |
| 133 | +- `task ios:dev:device` kept for reference but has known issues (WebSocket connection, WebKit sandbox) |
| 134 | + |
| 135 | +**Files modified:** |
| 136 | +- `taskfiles/ios.yml` - Added `run:device` task |
| 137 | +- `CLAUDE.md` - Updated to recommend `ios:run:device` for physical device testing |
| 138 | + |
| 139 | +**Final cleanup:** |
| 140 | +- Removed `task ios:dev:device` (unreliable due to Tauri dev mode WebKit sandbox issues) |
| 141 | +- Renamed workflow to `task ios:run:device` (release build approach) |
| 142 | +- Updated CLAUDE.md and README.md |
| 143 | + |
| 144 | +**Final Resolution:** |
| 145 | + |
| 146 | +- Root cause: CSS viewport height issue - iOS WKWebView doesn't handle `height: 100%` correctly |
| 147 | +- Fix: Added `min-height: 100dvh` to `.app-container` with `@supports` for `100svh` (small viewport height) |
| 148 | +- Verified working on both iOS simulator and physical device (iPhone 13 mini) |
| 149 | +- AC #5 N/A - was a real CSS regression, not simulator-only quirk |
| 150 | + |
| 151 | +**Additional fixes during investigation:** |
| 152 | +- Fixed Xcode build PATH issue (mise shims not in PATH) |
| 153 | +- Added ENABLE_USER_SCRIPT_SANDBOXING: false to project.yml |
| 154 | +- Fixed device ID extraction in ios:run:device task |
| 155 | +- Created reliable physical device workflow via release builds |
| 156 | +<!-- SECTION:NOTES:END --> |
0 commit comments