wordpress-mobile / wordpress-mobile/WordPress-Android

Dialogs Declared in GutenbergEditorFragment Lost/Dismissed with Screen Rotation

Open
#14,676 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Pri] Low [Type] Bug Gutenberg Posting/Editing
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

Expected behavior

I expected dialogs to remain on screen, even when the orientation is changed from portrait to landscape.

Actual behavior

The following dialogs declared in the GutenbergEditorFragment file are lost/dismissed with screen rotation:

This is not only unexpected but can lead to some buggy behaviour, an example of which is given in the below steps to reproduce.

Steps to reproduce the behavior
Steps for showCancelMediaUploadDialog
  • Navigate to the post editor.
  • Add a new image block and choose the option to upload an image directly from your device.
  • Immediately tap on the image block as the upload begins in order to generate the "cancel" dialog.
  • Switch the orientation of the device and observe how the dialog is lost.

Additional buggy behaviour to note from this specific example: The image will appear to be permanently in an "uploading" state and any attempts to tap on it result in the "cancel" dialog appearing again, even though the image has been uploaded to the site's media library.

The "after" from the following screenshot shows the loading indicator overlaying the image, following the above steps, even though the image has actually been uploaded to the site's media library. If I tap on the image in this case, the "cancel" dialog appears again, even though it's not actually possible to prevent the upload.

Before Rotation After Rotation
Steps for Other Dialogs
showCancelMediaCollectionSaveDialog
  • Navigate to the post editor.
  • Add a new story block and choose the option to upload multiple images directly from your device.
  • Immediately tap on the story block as the uploads begin in order to generate the dialog.
  • Switch the orientation of the device and observe how the dialog is lost.
showCancelMediaCollectionUploadDialog
  • Navigate to the post editor.
  • Add a new story block and choose the option to upload multiple images directly from your device.
  • Immediately tap on the story block as the uploads begin. The showCancelMediaCollectionSaveDialog will be the first one to display, but the showCancelMediaCollectionUploadDialog will eventually display some time between the image saving and the uploads completing.
  • Switch the orientation of the device and observe how the dialog is lost.
showRetryMediaCollectionUploadDialog
  • Navigate to the post editor.
  • Add a new story block and choose the option to upload multiple images directly from your device.
  • Immediately enable airplane mode in order to prevent the images from uploading.
  • Return to the story block and top on it to generate the dialog.
  • Switch the orientation of the device and observe how the dialog is lost.
showRetryMediaUploadDialog
  • Navigate to the post editor.
  • Add a new image block and choose the option to upload a new image directly from your device.
  • Immediately enable airplane mode in order to prevent the image from uploading.
  • Return to the image block and tap on it to generate the dialog.
  • Switch the orientation of the device and observe how the dialog is lost.
screenshots for reference
showCancelMediaCollectionSaveDialog showCancelMediaCollectionUploadDialog
showRetryMediaCollectionUploadDialog showRetryMediaUploadDialog
Tested on Pixel 5, Android 11, WPAndroid 17.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java and inspect the five named dialog methods around fragment recreation. Reproduce the listed upload and airplane-mode cases while rotating the device, then verify each dialog remains available after rotation and no longer leaves uploads in an incorrect state.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.