fix(ios): surface block inserter media failures to the user - #598
Open
dcalhoun wants to merge 1 commit into
Open
fix(ios): surface block inserter media failures to the user#598dcalhoun wants to merge 1 commit into
dcalhoun wants to merge 1 commit into
Conversation
`BlockInserterViewModel.error` was assigned on media import failure but never read, so a failed photo import or camera capture showed nothing at all — the inserter sheet stayed open with no feedback. Bind the property to an alert, and replace the system-derived messages with a small set of localized strings. `URLError.unknown`'s description tells a user nothing actionable, and it is the likeliest failure (an iCloud photo not downloaded to the device). The camera path's message was also an unlocalized string literal. Also log the underlying error on both paths so the detail dropped from the user-facing message stays diagnosable, and only surface the picker alert when an error actually occurred, so an empty selection does not raise a spurious one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SrZVz6gAuLjo6Dj8hTNeJv
XCFramework BuildThis PR's XCFramework is available for testing. Add the following to your .package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/598")Built from cc36aa8 |
dcalhoun
marked this pull request as ready for review
August 21, 2026 23:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Media import failures in the native block inserter showed the user nothing at all.
BlockInserterViewModel.errorwas assigned but never read by any view, so a failed photo import or camera capture left the inserter sheet open with no feedback.Why?
The lack of user feedback during causes confusion.
How?
Bind
errorto an.alert(item:)inBlockInserterView—MediaErroris alreadyIdentifiable.Replace the system-derived messages with a small set of localized strings. Previously the picker path surfaced
error.localizedDescription, which for the commonURLError.unknowncase is generic text that tells a user nothing actionable, and the camera path threw an unlocalized"Failed to convert image to JPEG"literal. Three newEditorLocalizationcases: one shared alert title, one message per failure family, plusok. Hosts that do not translate them fall back to the editor's own strings and get a one-time log, per the existing design.Testing Instructions
Neither failure is easy to trigger organically — the picker path realistically needs an offloaded iCloud photo with no network, and the camera path needs a device. Apply the patch below to force both.
Reproduction patch — forces both failures
Both failures fire from independent entry points, so this triggers each one without toggling anything: the photo button demonstrates one message, the camera button the other.
This produces two
code after 'throw' will never be executedwarnings. Expected — wrapping each throw inif true { }silences them if you prefer a clean build.With the patch applied, in the Demo app:
Then revert the patch and confirm the regression path:
Accessibility Testing Instructions
With VoiceOver enabled, follow the steps above. On failure, VoiceOver should announce the alert title and message, and focus should move into the alert. Confirm the OK button is reachable and dismisses it, returning focus to the inserter.
Screenshots or screencast