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

[RNMobile] Search Block: Implement long button text handling #30855

Merged
merged 7 commits into from
Apr 16, 2021

Conversation

AmandaRiu
Copy link
Contributor

@AmandaRiu AmandaRiu commented Apr 15, 2021

Gutenberg Mobile PR: wordpress-mobile/gutenberg-mobile#3210

Description

This PR implements the design for moving the button below the input element if the button text makes the button grow to more than 50% of the available width of the block:

Screen Shot 2021-04-14 at 9 28 06 PM

Changes include the following:

  • If the button is more the 50% in portrait mode, but not more than 50% in landscape mode, the view will appropriately reflect these changes when changing orientation.
  • If the button is moved below the search input element due to the length of text, and then the user changes to icon only button, the button will be moved back up to be inline with the input element.
  • Updated snapshots for unit tests

Known issues/not included

  • Android text wraps before the text completely fills the button width. I'm not sure why this happens, but it doesn't appear to be related to my code directly (please let me know if I'm wrong about this). I've verified maxWidth is set appropriately but the text will still wrap before it fills the full width.

How has this been tested?

Test the following scenarios on iOS simulator and Android emulator.

Long button text moves button below search input element

  1. Add the Search Block.
  2. Click into the Search button text field and enter enough text to verify that the button is moved below the search input field when the width reaches about 50%.
  3. Delete the extra button text to verify the button will be moved inline with the search input field when expected.

Long text button moves back inline with search input when icon only option enabled

  1. Add the Search Block.
  2. Click into the Search button text field and enter enough text to verify that the button is moved below the search input field when the width reaches about 50%.
  3. Open the block settings.
  4. Toggle icon only button to "on" and verify button is moved back up to be inline with search input element.

Long button with button position set to "inside"

  1. Add the Search Block.
  2. Click into the Search button text field and enter enough text to verify that the button is moved below the search input field when the width reaches about 50%.
  3. Open block settings.
  4. Change "button position" option to "Inside". Verify design.

Long button recalculated on orientation change

  1. Add the Search Block in portrait mode.
  2. Click into the Search button text field and enter just enough text so the button moves below the search input element.
  3. Rotate the device to landscape mode. Verify the button moves back up to be inline with the search input element.
  4. Enter more text in the button to verify that once the button is about 50% of the width it gets moved below the search input element.

Screenshots

Interacting with the UI

Screen.Recording.2021-04-14.at.6.24.16.PM.mov

Rotating on Android

android-rotate.mov

Rotating on iOS

ios-rotate.mov

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@AmandaRiu AmandaRiu added [Block] Search Affects the Search Block - used to display a search field Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Apr 15, 2021
@AmandaRiu
Copy link
Contributor Author

cc: @iamthomasbishop

@github-actions
Copy link

github-actions bot commented Apr 15, 2021

Size Change: +2.13 kB (0%)

Total Size: 1.46 MB

Filename Size Change
build/annotations/index.js 3.78 kB -2 B (0%)
build/api-fetch/index.js 3.41 kB +5 B (0%)
build/autop/index.js 2.81 kB -10 B (0%)
build/block-editor/index.js 128 kB +29 B (0%)
build/block-library/blocks/site-logo/editor-rtl.css 440 B +2 B (0%)
build/block-library/blocks/site-logo/editor.css 441 B +3 B (+1%)
build/block-library/blocks/site-logo/style-rtl.css 154 B +4 B (+3%)
build/block-library/blocks/site-logo/style.css 154 B +4 B (+3%)
build/block-library/blocks/video/editor-rtl.css 568 B +64 B (+13%) ⚠️
build/block-library/blocks/video/editor.css 569 B +66 B (+13%) ⚠️
build/block-library/editor-rtl.css 9.79 kB +22 B (0%)
build/block-library/editor.css 9.78 kB +21 B (0%)
build/block-library/index.js 153 kB +206 B (0%)
build/block-library/style-rtl.css 9.43 kB +4 B (0%)
build/block-library/style.css 9.44 kB +4 B (0%)
build/block-serialization-default-parser/index.js 1.87 kB -1 B (0%)
build/blocks/index.js 48.5 kB -3 B (0%)
build/components/index.js 286 kB -24 B (0%)
build/compose/index.js 11.2 kB +3 B (0%)
build/core-data/index.js 17.1 kB -2 B (0%)
build/customize-widgets/index.js 7.11 kB +28 B (0%)
build/data/index.js 8.87 kB -7 B (0%)
build/date/index.js 31.9 kB +1 B (0%)
build/dom/index.js 5.1 kB +2 B (0%)
build/edit-navigation/index.js 17 kB -1 B (0%)
build/edit-post/index.js 339 kB +494 B (0%)
build/edit-post/style-rtl.css 6.99 kB +17 B (0%)
build/edit-post/style.css 6.98 kB +18 B (0%)
build/edit-site/index.js 28.3 kB -5 B (0%)
build/edit-widgets/index.js 16.8 kB +1.08 kB (+7%) 🔍
build/editor/index.js 42.6 kB +119 B (0%)
build/element/index.js 4.61 kB +1 B (0%)
build/format-library/index.js 6.75 kB -5 B (0%)
build/html-entities/index.js 622 B -1 B (0%)
build/i18n/index.js 4.04 kB +1 B (0%)
build/is-shallow-equal/index.js 699 B +1 B (0%)
build/redux-routine/index.js 2.83 kB -3 B (0%)
build/url/index.js 3.02 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/blob/index.js 664 B 0 B
build/block-directory/index.js 8.62 kB 0 B
build/block-directory/style-rtl.css 1 kB 0 B
build/block-directory/style.css 1.01 kB 0 B
build/block-editor/style-rtl.css 12.5 kB 0 B
build/block-editor/style.css 12.5 kB 0 B
build/block-library/blocks/archives/editor-rtl.css 61 B 0 B
build/block-library/blocks/archives/editor.css 60 B 0 B
build/block-library/blocks/audio/editor-rtl.css 58 B 0 B
build/block-library/blocks/audio/editor.css 58 B 0 B
build/block-library/blocks/audio/style-rtl.css 112 B 0 B
build/block-library/blocks/audio/style.css 112 B 0 B
build/block-library/blocks/block/editor-rtl.css 161 B 0 B
build/block-library/blocks/block/editor.css 161 B 0 B
build/block-library/blocks/button/editor-rtl.css 475 B 0 B
build/block-library/blocks/button/editor.css 474 B 0 B
build/block-library/blocks/button/style-rtl.css 503 B 0 B
build/block-library/blocks/button/style.css 503 B 0 B
build/block-library/blocks/buttons/editor-rtl.css 315 B 0 B
build/block-library/blocks/buttons/editor.css 315 B 0 B
build/block-library/blocks/buttons/style-rtl.css 368 B 0 B
build/block-library/blocks/buttons/style.css 368 B 0 B
build/block-library/blocks/calendar/style-rtl.css 208 B 0 B
build/block-library/blocks/calendar/style.css 208 B 0 B
build/block-library/blocks/categories/editor-rtl.css 84 B 0 B
build/block-library/blocks/categories/editor.css 83 B 0 B
build/block-library/blocks/categories/style-rtl.css 79 B 0 B
build/block-library/blocks/categories/style.css 79 B 0 B
build/block-library/blocks/code/style-rtl.css 90 B 0 B
build/block-library/blocks/code/style.css 90 B 0 B
build/block-library/blocks/columns/editor-rtl.css 190 B 0 B
build/block-library/blocks/columns/editor.css 190 B 0 B
build/block-library/blocks/columns/style-rtl.css 436 B 0 B
build/block-library/blocks/columns/style.css 435 B 0 B
build/block-library/blocks/cover/editor-rtl.css 605 B 0 B
build/block-library/blocks/cover/editor.css 605 B 0 B
build/block-library/blocks/cover/style-rtl.css 1.23 kB 0 B
build/block-library/blocks/cover/style.css 1.23 kB 0 B
build/block-library/blocks/embed/editor-rtl.css 486 B 0 B
build/block-library/blocks/embed/editor.css 486 B 0 B
build/block-library/blocks/embed/style-rtl.css 401 B 0 B
build/block-library/blocks/embed/style.css 400 B 0 B
build/block-library/blocks/file/editor-rtl.css 175 B 0 B
build/block-library/blocks/file/editor.css 174 B 0 B
build/block-library/blocks/file/style-rtl.css 248 B 0 B
build/block-library/blocks/file/style.css 248 B 0 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB 0 B
build/block-library/blocks/freeform/editor.css 2.44 kB 0 B
build/block-library/blocks/gallery/editor-rtl.css 704 B 0 B
build/block-library/blocks/gallery/editor.css 705 B 0 B
build/block-library/blocks/gallery/style-rtl.css 1.09 kB 0 B
build/block-library/blocks/gallery/style.css 1.09 kB 0 B
build/block-library/blocks/group/editor-rtl.css 160 B 0 B
build/block-library/blocks/group/editor.css 160 B 0 B
build/block-library/blocks/group/style-rtl.css 57 B 0 B
build/block-library/blocks/group/style.css 57 B 0 B
build/block-library/blocks/heading/editor-rtl.css 129 B 0 B
build/block-library/blocks/heading/editor.css 129 B 0 B
build/block-library/blocks/heading/style-rtl.css 76 B 0 B
build/block-library/blocks/heading/style.css 76 B 0 B
build/block-library/blocks/html/editor-rtl.css 281 B 0 B
build/block-library/blocks/html/editor.css 281 B 0 B
build/block-library/blocks/image/editor-rtl.css 717 B 0 B
build/block-library/blocks/image/editor.css 716 B 0 B
build/block-library/blocks/image/style-rtl.css 476 B 0 B
build/block-library/blocks/image/style.css 478 B 0 B
build/block-library/blocks/latest-comments/style-rtl.css 281 B 0 B
build/block-library/blocks/latest-comments/style.css 282 B 0 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B 0 B
build/block-library/blocks/latest-posts/editor.css 137 B 0 B
build/block-library/blocks/latest-posts/style-rtl.css 523 B 0 B
build/block-library/blocks/latest-posts/style.css 522 B 0 B
build/block-library/blocks/legacy-widget/editor-rtl.css 398 B 0 B
build/block-library/blocks/legacy-widget/editor.css 399 B 0 B
build/block-library/blocks/list/style-rtl.css 63 B 0 B
build/block-library/blocks/list/style.css 63 B 0 B
build/block-library/blocks/media-text/editor-rtl.css 191 B 0 B
build/block-library/blocks/media-text/editor.css 191 B 0 B
build/block-library/blocks/media-text/style-rtl.css 535 B 0 B
build/block-library/blocks/media-text/style.css 532 B 0 B
build/block-library/blocks/more/editor-rtl.css 434 B 0 B
build/block-library/blocks/more/editor.css 434 B 0 B
build/block-library/blocks/navigation-link/editor-rtl.css 597 B 0 B
build/block-library/blocks/navigation-link/editor.css 597 B 0 B
build/block-library/blocks/navigation-link/style-rtl.css 1.07 kB 0 B
build/block-library/blocks/navigation-link/style.css 1.07 kB 0 B
build/block-library/blocks/navigation/editor-rtl.css 1.24 kB 0 B
build/block-library/blocks/navigation/editor.css 1.24 kB 0 B
build/block-library/blocks/navigation/style-rtl.css 272 B 0 B
build/block-library/blocks/navigation/style.css 271 B 0 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B 0 B
build/block-library/blocks/nextpage/editor.css 395 B 0 B
build/block-library/blocks/page-list/editor-rtl.css 239 B 0 B
build/block-library/blocks/page-list/editor.css 240 B 0 B
build/block-library/blocks/page-list/style-rtl.css 167 B 0 B
build/block-library/blocks/page-list/style.css 167 B 0 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B 0 B
build/block-library/blocks/paragraph/editor.css 157 B 0 B
build/block-library/blocks/paragraph/style-rtl.css 247 B 0 B
build/block-library/blocks/paragraph/style.css 248 B 0 B
build/block-library/blocks/post-author/editor-rtl.css 209 B 0 B
build/block-library/blocks/post-author/editor.css 209 B 0 B
build/block-library/blocks/post-author/style-rtl.css 183 B 0 B
build/block-library/blocks/post-author/style.css 184 B 0 B
build/block-library/blocks/post-comments-form/style-rtl.css 250 B 0 B
build/block-library/blocks/post-comments-form/style.css 250 B 0 B
build/block-library/blocks/post-content/editor-rtl.css 139 B 0 B
build/block-library/blocks/post-content/editor.css 139 B 0 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B 0 B
build/block-library/blocks/post-excerpt/editor.css 73 B 0 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B 0 B
build/block-library/blocks/post-excerpt/style.css 69 B 0 B
build/block-library/blocks/post-featured-image/editor-rtl.css 338 B 0 B
build/block-library/blocks/post-featured-image/editor.css 338 B 0 B
build/block-library/blocks/post-featured-image/style-rtl.css 100 B 0 B
build/block-library/blocks/post-featured-image/style.css 100 B 0 B
build/block-library/blocks/post-title/style-rtl.css 60 B 0 B
build/block-library/blocks/post-title/style.css 60 B 0 B
build/block-library/blocks/preformatted/style-rtl.css 103 B 0 B
build/block-library/blocks/preformatted/style.css 103 B 0 B
build/block-library/blocks/pullquote/editor-rtl.css 183 B 0 B
build/block-library/blocks/pullquote/editor.css 183 B 0 B
build/block-library/blocks/pullquote/style-rtl.css 318 B 0 B
build/block-library/blocks/pullquote/style.css 318 B 0 B
build/block-library/blocks/query-loop/editor-rtl.css 83 B 0 B
build/block-library/blocks/query-loop/editor.css 82 B 0 B
build/block-library/blocks/query-loop/style-rtl.css 315 B 0 B
build/block-library/blocks/query-loop/style.css 317 B 0 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B 0 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B 0 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B 0 B
build/block-library/blocks/query-pagination/editor.css 262 B 0 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B 0 B
build/block-library/blocks/query-pagination/style.css 168 B 0 B
build/block-library/blocks/query-title/editor-rtl.css 86 B 0 B
build/block-library/blocks/query-title/editor.css 86 B 0 B
build/block-library/blocks/query/editor-rtl.css 810 B 0 B
build/block-library/blocks/query/editor.css 809 B 0 B
build/block-library/blocks/quote/style-rtl.css 169 B 0 B
build/block-library/blocks/quote/style.css 169 B 0 B
build/block-library/blocks/rss/editor-rtl.css 201 B 0 B
build/block-library/blocks/rss/editor.css 202 B 0 B
build/block-library/blocks/rss/style-rtl.css 290 B 0 B
build/block-library/blocks/rss/style.css 290 B 0 B
build/block-library/blocks/search/editor-rtl.css 189 B 0 B
build/block-library/blocks/search/editor.css 189 B 0 B
build/block-library/blocks/search/style-rtl.css 359 B 0 B
build/block-library/blocks/search/style.css 362 B 0 B
build/block-library/blocks/separator/editor-rtl.css 99 B 0 B
build/block-library/blocks/separator/editor.css 99 B 0 B
build/block-library/blocks/separator/style-rtl.css 251 B 0 B
build/block-library/blocks/separator/style.css 251 B 0 B
build/block-library/blocks/shortcode/editor-rtl.css 512 B 0 B
build/block-library/blocks/shortcode/editor.css 512 B 0 B
build/block-library/blocks/social-link/editor-rtl.css 164 B 0 B
build/block-library/blocks/social-link/editor.css 165 B 0 B
build/block-library/blocks/social-links/editor-rtl.css 796 B 0 B
build/block-library/blocks/social-links/editor.css 795 B 0 B
build/block-library/blocks/social-links/style-rtl.css 1.32 kB 0 B
build/block-library/blocks/social-links/style.css 1.33 kB 0 B
build/block-library/blocks/spacer/editor-rtl.css 308 B 0 B
build/block-library/blocks/spacer/editor.css 308 B 0 B
build/block-library/blocks/spacer/style-rtl.css 48 B 0 B
build/block-library/blocks/spacer/style.css 48 B 0 B
build/block-library/blocks/table/editor-rtl.css 478 B 0 B
build/block-library/blocks/table/editor.css 478 B 0 B
build/block-library/blocks/table/style-rtl.css 402 B 0 B
build/block-library/blocks/table/style.css 402 B 0 B
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B 0 B
build/block-library/blocks/tag-cloud/editor.css 118 B 0 B
build/block-library/blocks/tag-cloud/style-rtl.css 94 B 0 B
build/block-library/blocks/tag-cloud/style.css 94 B 0 B
build/block-library/blocks/template-part/editor-rtl.css 552 B 0 B
build/block-library/blocks/template-part/editor.css 551 B 0 B
build/block-library/blocks/term-description/editor-rtl.css 90 B 0 B
build/block-library/blocks/term-description/editor.css 90 B 0 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B 0 B
build/block-library/blocks/text-columns/editor.css 95 B 0 B
build/block-library/blocks/text-columns/style-rtl.css 166 B 0 B
build/block-library/blocks/text-columns/style.css 166 B 0 B
build/block-library/blocks/verse/style-rtl.css 87 B 0 B
build/block-library/blocks/verse/style.css 87 B 0 B
build/block-library/blocks/video/style-rtl.css 173 B 0 B
build/block-library/blocks/video/style.css 173 B 0 B
build/block-library/common-rtl.css 1.31 kB 0 B
build/block-library/common.css 1.31 kB 0 B
build/block-library/reset-rtl.css 502 B 0 B
build/block-library/reset.css 503 B 0 B
build/block-library/theme-rtl.css 692 B 0 B
build/block-library/theme.css 693 B 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/components/style-rtl.css 16.3 kB 0 B
build/components/style.css 16.3 kB 0 B
build/customize-widgets/style-rtl.css 630 B 0 B
build/customize-widgets/style.css 631 B 0 B
build/data-controls/index.js 835 B 0 B
build/deprecated/index.js 787 B 0 B
build/dom-ready/index.js 577 B 0 B
build/edit-navigation/style-rtl.css 2.86 kB 0 B
build/edit-navigation/style.css 2.86 kB 0 B
build/edit-post/classic-rtl.css 454 B 0 B
build/edit-post/classic.css 454 B 0 B
build/edit-site/style-rtl.css 4.9 kB 0 B
build/edit-site/style.css 4.89 kB 0 B
build/edit-widgets/style-rtl.css 2.97 kB 0 B
build/edit-widgets/style.css 2.98 kB 0 B
build/editor/style-rtl.css 3.92 kB 0 B
build/editor/style.css 3.92 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/style-rtl.css 637 B 0 B
build/format-library/style.css 639 B 0 B
build/hooks/index.js 2.28 kB 0 B
build/keyboard-shortcuts/index.js 2.52 kB 0 B
build/keycodes/index.js 1.95 kB 0 B
build/list-reusable-blocks/index.js 3.19 kB 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/media-utils/index.js 5.38 kB 0 B
build/notices/index.js 1.85 kB 0 B
build/nux/index.js 3.41 kB 0 B
build/nux/style-rtl.css 731 B 0 B
build/nux/style.css 727 B 0 B
build/plugins/index.js 2.95 kB 0 B
build/primitives/index.js 1.42 kB 0 B
build/priority-queue/index.js 791 B 0 B
build/react-i18n/index.js 1.46 kB 0 B
build/reusable-blocks/index.js 3.78 kB 0 B
build/reusable-blocks/style-rtl.css 225 B 0 B
build/reusable-blocks/style.css 225 B 0 B
build/rich-text/index.js 13.5 kB 0 B
build/server-side-render/index.js 2.6 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/viewport/index.js 1.86 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@AmandaRiu AmandaRiu requested a review from geriux April 15, 2021 15:29
@AmandaRiu
Copy link
Contributor Author

@geriux I've made the suggested changes. Thank you for the tip, that really helped to remove a lot of unnecessary code.

Copy link

@iamthomasbishop iamthomasbishop left a comment

Choose a reason for hiding this comment

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

This looks really great, @AmandaRiu. I definitely prefer this approach over the web's because it more gracefully accommodates long labels, but I worry that despite the layout looking like a cluster, folks will be a little confused when they see a mismatch between the layout in the mobile editor vs. the front-end output. I think this is one of those awkward cases where we have to decide whether we should:

  1. Align with the front-end output (and core) and have a...less-than-ideal UI in the editor in order to match with the output, or...
  2. Make it look nicer in the editor (like you have here) which will result in a diff between what the user is seeing in the editor and on the front-end of their site

As much as it pains me to say, I think it'd be better to align with styling of the output (at least in terms of layout) for the time being. However, I believe this approach would be beneficial everywhere, so we should propose it upstream to core Gutenberg. I understand this isn't ideal, but it might be worth considering for a long-term solution.

@kyleaparker what do you think? Is it worth diverging from the output in this case, wrt layout behavior?


Note: my assumption here is that the front-end result that we're producing uses the same exact markup that is applied using the web editor — if I'm wrong and we're applying our own set of styles to make the block behave as it does in the mobile editor, then by all means, let's roll with this 😃

@AmandaRiu
Copy link
Contributor Author

Note: my assumption here is that the front-end result that we're producing uses the same exact markup that is applied using the web editor — if I'm wrong and we're applying our own set of styles to make the block behave as it does in the mobile editor, then by all means, let's roll with this 😃

Hi @iamthomasbishop 👋 This design is specific and custom to the mobile editor and was in the i2 designs for the mobile version of the search block. I believe @kyleaparker approached this much like we approach the columns block in the mobile editor which shows each column as a row if space is limited. Editing the columns on mobile will look differently than web which may have some drawbacks, but the experience and UX is so much better than if we tried to make everything on mobile look just like it would on the web.

The Search block is due at the end of this sprint (tomorrow) and this PR is blocking the final PR that will put the Search block into production so I'd like to get a final yay or nay on this functionality if possible. Thank you for the review!

@kyleaparker
Copy link

@kyleaparker what do you think? Is it worth diverging from the output in this case, wrt layout behavior?

I think it is! If you're editing your site on mobile we should make sure you have the most optimal user experience. We should definitely push for this change for the web because long button text alongside a search input looks a little broken right now. We should also push towards a front end that matches and provides the best mobile experience for site visitors.

FWIW, I don't think too many people will deviate from the Search text so I imagine the number of people who see this layout will be small.

@iamthomasbishop
Copy link

iamthomasbishop commented Apr 15, 2021

@AmandaRiu To be clear, I don't think this is worth blocking the rest of the project — I would consider it somewhat of an edge case that will only be experienced if you have a super-long text label. With that said, I did want to discuss because there is a potential for a relatively large mismatch between what the user sees on the front-end vs. in the editor. Definitely not worth holding up the entire project for, but rather something we can decide and iterate on.

I get where you're coming from and 100% agree that the interaction model here is better from a UX perspective inside the editor, but if the produced layout on the front-end is substantially different (in this case, worse) then it's bound to cause confusion (in this particular case where they have a very long label — again, probably an edge case).

Regarding Columns, unless there's a new bug I'm not aware of, layouts that you build in the mobile editor should be laid out on the front-end in roughly the same way and utilize the same breakpoints that are provided by core GB. IIRC, when we worked on the initial versions of Columns we made the same sort of decision — to follow the same breakpoints and layout that exist on the web (for better or worse).

@iamthomasbishop
Copy link

@kyleaparker I agree w/ most of what you're saying; it does feel counter-intuitive to suggest that we not default to the absolute best authoring experience. 😄 I just wanted to voice my concern about the potential frustration a user might experience when they've added a long label in the editor (which adapts nicely as shown above), but sees that the result on the front-end is janky — but that's part of a much bigger conversation. Considering the scale of impact for better or worse is small in this case, I'm totally fine with whatever y'all think is best here!

@AmandaRiu
Copy link
Contributor Author

@kyleaparker @iamthomasbishop I appreciate the open discussion and thank you for all your input. I agree there is so much gray area here and it's a difficult and very important thing to be aware of so we can create the best possible experience for the user. That said, it sounds like we are keeping these changes so this PR is good to merge once approved. 👍

@AmandaRiu
Copy link
Contributor Author

NOTE: Opened a ticket to have this same functionality ported to the mobile web version as well.

Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

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

LGTM. I tested this an iPhone SE and the Android emulator. Operated as expected, aside from one comment regarding the button width expanding while typing.

@dcalhoun
Copy link
Member

@AmandaRiu I did just run into an issue that may be worth investigating further. 😞 When (1) inserting the Search block while having (2) a text block focused and (3) using the block inserter search, an infinite focus loop is created. This does not occur if I do not have all three of those criteria met.

  1. Launch the block editor.
  2. Tap the title of the editor to focus the text field.
  3. Tap the + button to open the block inserter.
  4. Search for the Search block.
  5. Select the search block.

An infinite focus loop is created, which eventually would likely lead to a crash.

This is not the first time I have seen an infinite loop. There are a few open issues — wordpress-mobile/gutenberg-mobile#953, wordpress-mobile/gutenberg-mobile#1696. However, this one was pretty easy for me to recreate. I have not yet tested this within the WPiOS and WPAndroid apps themselves, only the Demo editor app. I'm not sure if the issue would be better or worse in the actual apps. I'll try to find time help investigate, but it may be a bit before I can spend more time.

RPReplay_Final1618531729.MP4

@AmandaRiu
Copy link
Contributor Author

@AmandaRiu I did just run into an issue that may be worth investigating further. 😞 When (1) inserting the Search block while having (2) a text block focused and (3) using the block inserter search, an infinite focus loop is created. This does not occur if I do not have all three of those criteria met.

1. Launch the block editor.

2. Tap the title of the editor to focus the text field.

3. Tap the + button to open the block inserter.

4. Search for the Search block.

5. Select the search block.

An infinite focus loop is created, which eventually would likely lead to a crash.

This is not the first time I have seen an infinite loop. There are a few open issues — wordpress-mobile/gutenberg-mobile#953, wordpress-mobile/gutenberg-mobile#1696. However, this one was pretty easy for me to recreate. I have not yet tested this within the WPiOS and WPAndroid apps themselves, only the Demo editor app. I'm not sure if the issue would be better or worse in the actual apps. I'll try to find time help investigate, but it may be a bit before I can spend more time.
RPReplay_Final1618531729.MP4

Thanks for the review @dcalhoun! I tried to replicate the focus issue but am not having any luck. I tried on an Android emulator, as well as my Pixel 4 running Android 11. What are the specs of the device you were using for testing?

screen-20210415-204742.mp4

@AmandaRiu AmandaRiu merged commit 1e48e9d into trunk Apr 16, 2021
@AmandaRiu AmandaRiu deleted the rnmobile/search-block-long-button-text branch April 16, 2021 00:52
@github-actions github-actions bot added this to the Gutenberg 10.5 milestone Apr 16, 2021
@dcalhoun
Copy link
Member

What are the specs of the device you were using for testing?

iPhone SE, iOS 14.4.2. Local Metro server running on this branch. I'll try to spend some time tomorrow investigating further.

@geriux
Copy link
Member

geriux commented Apr 16, 2021

Regarding the loop problem, I created an issue #30562 for that (the search functionality is still in dev)

@AmandaRiu
Copy link
Contributor Author

What are the specs of the device you were using for testing?

iPhone SE, iOS 14.4.2. Local Metro server running on this branch. I'll try to spend some time tomorrow investigating further.

Aha! Okay, I tested on my physical iPhone 11 running iOS v14.4.2 and can replicate this issue. It's not the search block however, it happens on any text block. Here's me testing with adding a paragraph block:

screencapture-1618854323923.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Search Affects the Search Block - used to display a search field Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants