Conversation
Add a new `NetworkFallbackMode` enum (.disabled / .automatic) alongside the existing `isOfflineModeEnabled` Bool. They are orthogonal: - `isOfflineModeEnabled`: no site exists, skip all networking - `networkFallbackMode`: site exists, but fall back to bundled editor on network failure instead of showing an error Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When `networkFallbackMode == .automatic`, wrap dependency fetching in a do/catch block. Network errors (URLError codes like notConnectedToInternet, timedOut, etc.) return empty dependencies so the bundled editor loads. Non-network errors still propagate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
A thin, full-width status bar displaying "Working Offline" that auto-shows/hides based on browser online/offline events. Uses a custom useNetworkConnectivity hook backed by navigator.onLine. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the OfflineIndicator component inside the ErrorBoundary, before the Editor, so it appears at the top of the editor content area. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test that the component: - Does not render when online - Renders "Working Offline" when navigator.onLine is false - Auto-hides when the online event fires - Re-appears when the offline event fires Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the new networkFallbackMode configuration, how it differs from isOfflineModeEnabled, and the OfflineIndicator JS component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a Picker in the Feature Configuration section of SitePreparationView to switch between .disabled and .automatic network fallback modes, following the same pattern as the existing Post Type picker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e is offline Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add role="status" and aria-label so screen readers announce "Network connection lost, working offline" when the indicator appears. Also fix inverted render guard that was hiding the indicator when offline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace role="status" and aria-label with an imperative speak() call from @wordpress/a11y, which announces "Network connection lost" when the device goes offline. This avoids VoiceOver's duplicate reading of live region content and accessible name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cator Keep useNetworkConnectivity as a pure data hook and let the component own its accessibility behavior via a separate useEffect. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| function useNetworkConnectivity() { | ||
| const [ isConnected, setIsConnected ] = useState( navigator.onLine ); | ||
|
|
||
| useEffect( () => { | ||
| const handleOnline = () => setIsConnected( true ); | ||
| const handleOffline = () => setIsConnected( false ); | ||
|
|
||
| window.addEventListener( 'online', handleOnline ); | ||
| window.addEventListener( 'offline', handleOffline ); | ||
|
|
||
| return () => { | ||
| window.removeEventListener( 'online', handleOnline ); | ||
| window.removeEventListener( 'offline', handleOffline ); | ||
| }; | ||
| }, [] ); | ||
|
|
||
| return { isConnected }; | ||
| } |
There was a problem hiding this comment.
Using navigator.onLine and the online/offline events is proving highly unreliable. Namely, they don't ever report an "offline" state in Android Chrome when airplane mode is activated (and wi-fi disabled). So, this needs to be replaced.
That said, the primary target of this work is ensuring the iOS editor opens when offline. Currently, it displays a full-screen error message.
I consider this PR a quick iteration to improve the UX. I plan to follow up later, refactoring this "Working Offline" indicator to rely upon native OS capabilities that are far more capable of detecting internet—either within the GBK library or from bridge communication with the host app.
In the meantime, I suggest we merge this given it unblocks the editor on iOS while offline.
What?
Improve the offline editor experience by adding network fallback mode support, an offline indicator, and graceful degradation when the device is offline.
Why?
Fix CMM-1206.
When opening the iOS GutenbergKit editor while offline without a cached bundle, the editor fails to load entirely. The expected behavior is to fall back to the bundled editor and display a notice indicating that the user is offline.
How?
NetworkFallbackModeenum and configuration property that enables automatic fallback to bundled resources when network requests fail (EditorService,EditorConfiguration).OfflineIndicatorcomponent that displays a "Working Offline" status bar with an offline icon when the device loses connectivity, using browser online/offline events. Usesspeak()from@wordpress/a11yto announce "Network connection lost, working offline" for screen readers.Testing Instructions
Accessibility Testing Instructions
Screenshots or screencast
gbk-ios-network-fallback.mp4