gutenberg-mobile
gutenberg-mobile copied to clipboard
Scroll to new-block indicator
Fixes #1672
Adds automatic scrolling to where the block inserter is on native mobile, when adding a new block (Block Picker active). Not covering the case of adding a new block inside a group/innerblock block.
Gutenberg PR: https://github.com/WordPress/gutenberg/pull/31144
To test: TBD
PR submission checklist:
- [x] I have considered adding unit tests where possible.
- [ ] I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary.
Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!
Note to self: Looks like one iOS UI test (should add a file to the block) is failing because the test picks up a parent element with accessibility name Post title. Welcome to Gutenberg! File Block. Row 1 Paragraph Block. Row 2. Empty Add paragraph block and tapping on it creates a new paragraph block just like tapping on the empty space under the blocks. I debugged the //*[contains(@${ this.accessibilityIdXPathAttrib }, " Block. Row ")] xpath locator using the https://github.com/appium/ruby_console (linked via http://appium.io/docs/en/writing-running-appium/finding-elements/) with appium.txt contents:
[caps]
platformName = "iOS"
os = "iOS"
deviceOrientation = "portrait"
automationName = "XCUITest"
deviceName = "iPhone 11"
platformVersion = "14.4"
and this REPL commands:
block=driver.find_element(:xpath, "//*[contains(@name, \" Block. Row \")]")
block.name
the last of which outputted: "Post title. Welcome to Gutenberg! File Block. Row 1 Paragraph Block. Row 2. Empty Add paragraph block".
Edit: same block is found on current gb-mobile develop, so the issue must be different. I suspect the change to the list footer that enlarged the tapping area for appending a new block.
Another note to self: Some commands to try and cleanup the ios build to fix the LoadError - cannot load such file -- cocoapods/installer/podfile_validator issue:
rm -Rf gutenberg/packages/react-native-editor/ios/Pods/
rm -Rf gutenberg/packages/react-native-editor/ios/vendor/bundle/ruby/
cd gutenberg/packages/react-native-editor/io && pod install --repo-update
System Ruby was 2.6.0 while the gb-mobile nested one was 2.6.0 so, went ahead and rbenv install 2.6.0 && rbenv global 2.6.0 too, followed by gem install bundler. With https://github.com/WordPress/gutenberg/pull/31144/commits/67f14b2589c8f7b620c11bf45b1373725712e925 I revised the helper method to return the last (hopefully the innermost) of the elements found but narrowing down to Row 1 at least.
For some reason, the enlarged block appender in the list footer is triggered on iOS when clicking the first component detected using the Block. Row accessibility pattern. With https://github.com/WordPress/gutenberg/pull/31144/commits/c2856b58bc3a19d04fd847be16e13dcb510a14ca I've revised the UI tests helper method to hopefully(?) grab the innermost component that is the actual block.
Closing since the functionality is already in at this point.