Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix move selected text on iOS #948

Merged
merged 2 commits into from
May 3, 2019
Merged

Conversation

etoledom
Copy link
Contributor

@etoledom etoledom commented May 2, 2019

fixes #843
Maybe this one too: wordpress-mobile/WordPress-iOS#11583

This PR fixes an issue where the editor enters on a onFocus/onBlur infinite loop. This was easily reproduced by selecting text on a paragraph block, and moving it inside the same block.

I tracked the issue until this line:

But we need it in order to let Gutenberg know that the TextView was focused by iOS. Needed to solve this issue: #702

With some investigation I noticed that textViewDidBeginEditing was sending one extra onFocus event that is not needed, and that triggered the loop. It was solved by sending the onFocus from becomeFirstResponder, with the proper checks.

move-selected

To test:

  • Run the example project on iOS
  • Select a long paragraph block.
  • Select some text long enough.
  • Long press to move it and release it somewhere else in the block.
  • Check that the editor behaves as expected.
  • Check that the Hide Keyboard button stays functional after presenting the Links UI. (check for Dismissing Links UI (BottomSheet) disables hide keyboard button. #702 )
  • Smoke test on Android.

@etoledom etoledom added this to the v1.4 milestone May 2, 2019
@etoledom etoledom requested a review from SergioEstevao May 2, 2019 08:26
@etoledom etoledom self-assigned this May 2, 2019
Copy link
Contributor

@SergioEstevao SergioEstevao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it on iOS and it's working great!

@etoledom
Copy link
Contributor Author

etoledom commented May 2, 2019

Thank you @SergioEstevao !

@mkevins or @marecar3 would you mind smoke-testing this on Android? 🙏

The change on AztecView.js remove some (supposedly unnecessary) calls to onFocus.
Checking that onFocus is called when it's necessary on RichText should be enough (that the RichText based blocks are being focused properly on different scenarios).

@etoledom etoledom modified the milestones: v1.4, v1.5 May 3, 2019
@daniloercoli daniloercoli self-requested a review May 3, 2019 08:37
Copy link
Contributor

@daniloercoli daniloercoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Android and worked as expected!

@etoledom etoledom modified the milestones: v1.5, v1.4 May 3, 2019
@etoledom etoledom merged commit 82228c5 into develop May 3, 2019
@etoledom
Copy link
Contributor Author

etoledom commented May 3, 2019

Thank you!

@etoledom etoledom deleted the issue/843-fix-move-selection-ios branch May 3, 2019 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Editor becomes unusable after moving selection in paragraph block.
3 participants