-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 incorrect block insertion point after blurring post title #32831
Fix incorrect block insertion point after blurring post title #32831
Conversation
Selecting the title selection status within the same `useSelect` for reusable blocks caused the title selection status to become stale, due to the dependency array for the `useSelect` hook. The staleness caused the block insertion point to show up in the incorrect location after blurring the title text input.
Size Change: 0 B Total Size: 1.04 MB ℹ️ View Unchanged
|
67a64cf
to
8f5443d
Compare
Yep, it can be tricky to assert the order, I'm wondering if we could do something similar to what we do in the UI tests. I saw that we use two methods for this purpose, the first one (used in I think both should work for this case but I'd lean on the second one because we could check also the content of the blocks, wdyt? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊 !
Tested on iPhone 8 (iOS 14.2) and Samsung Galaxy S20 FE 5G (Android 10).
The aspect that inhibited me asserting the order was that the insertion point does not have any positional information in its text or labels. However, I had not considered asserting that a newly add block is in the correct position. I like this idea because not only would it address the inhibitor I encountered, but it also tests the position of an inserted a block, rather than merely testing the position of the insertion point indicator. I will follow up with a separate PR to add tests asserting against the HTML. Thanks for the great idea! |
Awesome! In case you plan to add the blocks via the inserter, I opened this PR for the Reusable block that includes some fixes I had to do to enable the insertion. The tests pass so feel free to take those changes, but it's not ready yet because I wanted to refactor the |
Selecting the title selection status within the same `useSelect` for reusable blocks caused the title selection status to become stale, due to the dependency array for the `useSelect` hook. The staleness caused the block insertion point to show up in the incorrect location after blurring the title text input.
* Release script: Update react-native-editor version to 1.55.0 * Release script: Update with changes from 'npm run core preios' * Release script: Update react-native-editor version to 1.55.1 * Release script: Update with changes from 'npm run core preios' * Fix: RNMobile borderRadius value setting (#32717) * [RNMobile] Improve unsupported block message for reusable block (#32618) * Improve unsupported block message for reusable block The unsupported block message has been updated and the convert to regular blocks button has been also included. * Update unsupported block message of reusable block * Update react-native-editor changelog * Release script: Update react-native-editor version to 1.55.2 * Release script: Update with changes from 'npm run core preios' * Fix incorrect block insertion point after blurring post title (#32831) Selecting the title selection status within the same `useSelect` for reusable blocks caused the title selection status to become stale, due to the dependency array for the `useSelect` hook. The staleness caused the block insertion point to show up in the incorrect location after blurring the title text input. * Update changelog * Properly handle 404 errors while publishing Android artifacts (#32860) Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: Carlos Garcia <[email protected]> Co-authored-by: Enej Bajgoric <[email protected]> Co-authored-by: Oguz Kocer <[email protected]>
Add tests for a recently fix regression to decrease the changes of it from occurring again. Relates to #32831.
Relates to #32831. Adds tests asserting that block inserter inserts new blocks in the correct position after blurring the post title field.
Relates to #32831. Adds tests asserting that block inserter inserts new blocks in the correct position after blurring the post title field. Co-authored-by: Carlos Garcia <[email protected]>
Description
Fixes #32154. Selecting the title selection status within the same
useSelect
for reusable blocks caused the title selection status to become stale, due to the dependency array for theuseSelect
hook. The staleness caused the block insertion point to show up in the incorrect location after blurring the title text input.How has this been tested?
I attempted to add automated tests for this but ran into issues asserting the order of the elements. The primary issue was that our current tree structure does not have queryable attributes on the relevant elements, with no easy fix obvious to me. Additionally, React Native Testing Library's lack of support for traversing upwards the tree or snapshotting a subset of a rendered tree inhibited alternative methods.
The following was manually tested:
Screenshots
Before
block-insertion-before.mov
After
block-insertion-after.mov
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).