Skip to content

Link picker via fetch#2484

Merged
lukewalczak merged 16 commits intodevelopfrom
feature/link-picker-via-fetch-without-navigation
Sep 18, 2020
Merged

Link picker via fetch#2484
lukewalczak merged 16 commits intodevelopfrom
feature/link-picker-via-fetch-without-navigation

Conversation

@mkevins
Copy link
Copy Markdown
Contributor

@mkevins mkevins commented Jul 14, 2020

Related PRs

gutenberg: WordPress/gutenberg#23922
WordPress-Android: wordpress-mobile/WordPress-Android#12438
WordPress-iOS: wordpress-mobile/WordPress-iOS#14537

Details

This is a PR to produce a test apk for design review of the link picker feature.

To test:

Pre-testing steps:

  1. Install the apk the apk the apk from the WordPress-Android PR.
  2. Switch to a site which has some published posts and pages (site can be private)

Adding a link

  1. Create a new post
  2. Tap the first paragraph block
  3. Tap the link button to add a link (expect the fields to be blank)
  4. Tap the URL field (expect the modal to switch to full screen - picker / omni search mode)
  5. Type some letters and wait for results (expect results to be displayed below)
  6. Pick one of the results by tapping (expect previous screen to come back, populated with the item you picked)
  7. Dismiss the modal (via back, or swipe down) (expect new link to appear)

Editing a link

  1. Place the caret in an existing link (expect the link button to become highlighted)
  2. Tap the link button to edit the link (expect the fields to be populated)
  3. Tap the URL field (expect the modal to switch to full screen - picker / omni search mode)
  4. Delete the existing text, type some letters and wait for results (expect results to be displayed below)
  5. Pick one of the results by tapping (expect previous screen to come back, populated with the URL of the item you picked, but the link text should not be overwritten unless it was empty before)

Design questions

Note some known issues in the current implementation

  • Horizontal padding of the results header cell (the omni input) is more narrow than the results
  • The bottom-most results are partially blocked by the keyboard
  • On web, we wait until at least two characters are in the query before fetching results. Currently, I've left this requirement out (we fetch on every keystroke except an empty input), to make it easier to test (more results on smaller sites). This can be changed later, before merging.

URL "Input" (button)

On the main screen, I've made the button for editing the URL appear as a text input. When tapped, it opens the fullscreen modal for editing / searching the URL. When populated, that field appears with an ellipsizemode = "middle". Please let me know if this is acceptable:

Main screen (empty) Picker screen (empty) Main screen (populated)
main-screen-empty picker-screen-empty main-screen-filled

Direct entry suggestion

On web, there is a suggestion in the results for entering the URL "as is", however this appears at the bottom of the list, so it is hidden from view until you scroll all the way to the bottom. This is not ideal, IMO, and in our implementation, this would be worse, since every time we reach the bottom, we'd have new results fetched, pushing it further down. I've instead added this entry at the top. Let me know if this behavior is ok:

Mobile results screen Web results screen
picker-screen-t web-picker Direct entry not visible 👆 web-direct-input-bottom Direct entry at the bottom of the results 👆

Icons vs. pills

The web uses pills (on the right) to distinguish post "subtypes" such as "post" and "page", and also to distinguish other kinds of links (such as mailto: and tel: links). In earlier designs for mobile, we have icons (on the left), so I've added icons, but I'm not sure these are ideal for distinguishing between the types. I think we need to decide either on a set of icons that are easily distinguishable (especially between page / post) or maybe we can also go with "pills" like web. Here's how it looks now on web vs mobile:

Web "pills" Mobile icons
web-subtype-pills

Here's how it looks with neither icons, nor pills (mailto: link direct entry suggestion):

If we decide to use icons, it might be good to specify icons for the following types of links (which are supported by the current implementation):

  • post: A published post
  • page: A published page
  • mailto: A directly entered "mailto:" link
  • tel: A directly entered "tel:" link
  • internal: A directly entered anchor link ("#")

PR submission checklist:

  • 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](RELEASE-NOTES.txt) if necessary.

@mkevins mkevins added [Type] Enhancement Improves a current area of the editor [Status] DO NOT MERGE Do not merge this PR [Status] In Progress labels Jul 14, 2020
@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile Bot commented Jul 14, 2020

Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!

@iamthomasbishop
Copy link
Copy Markdown
Contributor

iamthomasbishop commented Jul 28, 2020

@mkevins @SylvesterWilmott I had a chance to give the latest build a proper spin, and I noted a few additional things that I think could be ironed out. I also made some sketches (attached below) in an effort to visualize my suggestions.

Labeling

  • Can we match the placeholder labels on the table row placeholder and the placeholder on the expanded sheet? (Search or type URL)
  • I believe the label on the expanded sheet should match the table row title (Link to)

Initial Sheet

  • Considering the transition from the initial sheet to the expanded one is utilizing the sheet-to-subsheet transition when you tap the Link to row (which might soon become a more prominent page-push transition), I think we should display a chevron/disclosure indicator on the right side of the row (see Buttons block color settings example)

Full Sheet

  • It looks like a few things are out of alignment, but I think this would likely be fixed by simply applying 16px of margin on the left and right of the row (eg. the icon and "URL" label, and placeholder label are all ~16 off). (Example)
  • Rather than display the URL title, would it make more sense to left-align the input placeholder/label in its place (at the 72 keyline, with the icon left of it)? This would give the input more breathing room and also feel a little more balanced, I think. We could even remove the icon so that the text input would span full-width (minus 16px margins on each side, of course)
  • Would it make sense to show a checkmark/"done" icon on the top right of the sheet header?
  • The spinner that shows while searching is okay, but I think it'd be preferable to use the native Android spinner if possible, and perhaps bump it down slightly (or centered vertically in the space between the last result and the keyboard)

Here is what all of the above would look like (yellow lines == matching labels, pink == tap gesture):

Other Questions

  • Will this also be applied to other instances of links, such as the Button link URL on Button, Link to on Image, etc?

@mkevins
Copy link
Copy Markdown
Contributor Author

mkevins commented Jul 29, 2020

Thanks for the awesome design feedback Thomas!

Labeling

  • Can we match the placeholder labels on the table row placeholder and the placeholder on the expanded sheet? (Search or type URL)
  • I believe the label on the expanded sheet should match the table row title (Link to)

✔️ Done

Initial Sheet

  • Considering the transition from the initial sheet to the expanded one is utilizing the sheet-to-subsheet transition when you tap the Link to row (which might soon become a more prominent page-push transition), I think we should display a chevron/disclosure indicator on the right side of the row (see Buttons block color settings example)

✔️ Done

Full Sheet

  • It looks like a few things are out of alignment, but I think this would likely be fixed by simply applying 16px of margin on the left and right of the row (eg. the icon and "URL" label, and placeholder label are all ~16 off). (Example)

✔️ Done

  • Rather than display the URL title, would it make more sense to left-align the input placeholder/label in its place (at the 72 keyline, with the icon left of it)? This would give the input more breathing room and also feel a little more balanced, I think. We could even remove the icon so that the text input would span full-width (minus 16px margins on each side, of course)

I agree this makes more sense. I have updated without the icon. Let me know what you think, or if I should add it back. Thanks for the great suggestions!

  • Would it make sense to show a checkmark/"done" icon on the top right of the sheet header?

I think it does make sense. Following the example from the custom color picker, I added the checkmark for Android, and the word "Apply" for iOS. Do you think that makes sense?

  • The spinner that shows while searching is okay, but I think it'd be preferable to use the native Android spinner if possible, and perhaps bump it down slightly (or centered vertically in the space between the last result and the keyboard)

✔️ Done - I added a 150 px container for the spinner (centered vertically within), and it stops displaying the extra space when we know we've reached the end of results. Let me know what you think of it, or if it needs adjusting the height.

Other Questions

  • Will this also be applied to other instances of links, such as the Button link URL on Button, Link to on Image, etc?

I believe this is the plan for further iterations. At the moment, there is still some ongoing work with the bottomsheet navigation, so I think it'd make sense for that to land before implementing in other bottomsheets, but I've had the other use-cases in mind while forming the interfaces, so it should be fairly straightforward to reuse the underlying components.

Thanks again for all your help @iamthomasbishop and @SylvesterWilmott !

@mkevins
Copy link
Copy Markdown
Contributor Author

mkevins commented Jul 29, 2020

@iamthomasbishop
Copy link
Copy Markdown
Contributor

@mkevins thanks for the update and for taking care of all of those changes so quickly! Testing out the latest Android and now iOS builds, and it's getting really close! I have some updated suggestions, and again I'd be curious to hear what @SylvesterWilmott thinks — and as always, feel free to point out if you disagree with anything!

I believe this is the plan for further iterations

Sounds good!

Expanded sheet

  • Input Alignment: I'm still not 100% sure about the alignment on the search input. I'd suggest we remove the margins on the left/right of the input so the input itself (and as a result, its border) is flush against the left/right edges of the screen. I would also keep the icon (either the previous "link" icon or a "search" icon) and align it to the 16px keyline — then align the label to the 72px keyline — 56px on iOS. Note: It might make sense to apply a slightly different input style for iOS, but I think this should work for both as a start.
  • Height on iOS: is it possible to also use a not-quite-full screen height on the sheet on iOS like we're doing on Android? What I mean is that the top of the sheet would be flush agains the bottom of the Status Bar. Having the UI go full-screen feels odd because you can't swipe from the left to go back as you'd typically do in iOS when you see a < Back button. If we have to keep it full screen, maybe we can do one of the following to remove that friction:
    • Find a way to allow the natural swipe gesture to close the sheet, or
    • Change the < Back button to Close

Search results

  • Very much a nitpick and not a blocker, but Is it possible to apply a unique subtitle (rather than "add this link") on the subtitles for mailto, tel? Eg. "add this link" makes sense for a standard URL, but for mailto it would make more sense to be "add email" or "email address", and for tel something like "add telephone number" or "telephone number" might make more sense, imo
  • Similar to the last bullet point, is it possible to show unique icons for tel and mailto (whereas right now, we're showing the "globe" icon — this isn't a blocker, but would be a nice refinement)
  • Should we change the color of the subtitle on each search result row to a lighter/secondary color and potentially make the label slightly smaller?

After selection

  • After an item is chosen from the expanded sheet, can we possibly display a cleaner label in the small sheet? Specifically for a post or page result, I think I'd rather see the post/page title. I think showing the raw URL for a url, tel , and mailto is fine.

That's all I've got for now! It's getting super close, and very usable already, so well done @mkevins !

@mkevins
Copy link
Copy Markdown
Contributor Author

mkevins commented Jul 31, 2020

Hi @iamthomasbishop , thanks for taking another look 😄

Expanded sheet

  • Input Alignment: I'm still not 100% sure about the alignment on the search input. I'd suggest we remove the margins on the left/right of the input so the input itself (and as a result, its border) is flush against the left/right edges of the screen. I would also keep the icon (either the previous "link" icon or a "search" icon) and align it to the 16px keyline — then align the label to the 72px keyline — 56px on iOS. Note: It might make sense to apply a slightly different input style for iOS, but I think this should work for both as a start.

✔️ Done

  • Height on iOS: is it possible to also use a not-quite-full screen height on the sheet on iOS like we're doing on Android? What I mean is that the top of the sheet would be flush agains the bottom of the Status Bar. Having the UI go full-screen feels odd because you can't swipe from the left to go back as you'd typically do in iOS when you see a < Back button. If we have to keep it full screen, maybe we can do one of the following to remove that friction:

    • Find a way to allow the natural swipe gesture to close the sheet, or

This one might be a little tricky with the current bottomsheet, but might be possible with the navigation in the bottomsheet that is currently underway. cc: @dratwas 👋 😃 any thoughts on this 👆 ?

  • Change the < Back button to Close

This is achievable, but to clarify, do you mean for it to close the bottomsheet altogether, or just modify the button text (and still return to the smaller link editing sheet)?

Search results

  • Very much a nitpick and not a blocker, but Is it possible to apply a unique subtitle (rather than "add this link") on the subtitles for mailto, tel? Eg. "add this link" makes sense for a standard URL, but for mailto it would make more sense to be "add email" or "email address", and for tel something like "add telephone number" or "telephone number" might make more sense, imo

Thanks for the suggestion. I've updated the summaries as follows: for email: "Add this email link", for telephone: "Add this telephone link". I can also remove the word "link" from those, but it felt weird without it, imo.

  • Similar to the last bullet point, is it possible to show unique icons for tel and mailto (whereas right now, we're showing the "globe" icon — this isn't a blocker, but would be a nice refinement)

Certainly! I looked around a bit in the Icons package, and also Gridicons, but I didn't find anything obvious for these. Once we have some Icons to use, it'll be easy to add. Btw, currently, it should not show the globe icon for those kinds of links.. did you encounter that? If so, perhaps the input value was missing the :? i.e. "tel" will not be detected as a telephone link, but "tel:" will.

After selection

  • After an item is chosen from the expanded sheet, can we possibly display a cleaner label in the small sheet? Specifically for a post or page result, I think I'd rather see the post/page title. I think showing the raw URL for a url, tel , and mailto is fine.

This one is a little tricky. The current behavior is that the post or page title will populate the "Link text" field upon returning, as long as it is empty (i.e. it will not overwrite that value if it is already populated). But, the values there directly correspond with the underlying rich text. We could hypothetically hide the full url, displaying only the the title instead, but I think we'll still need to display the link text. Some problems I can foresee are:

  • Link text and "URL" or "link" (or whatever we call that hybrid field) might be "duplicate" in that case
  • The post / page title doesn't uniquely identify the content (i.e. two can have the same title) - I'm not sure if this would be a major concern in practice though
  • After dismissing the modal, the post / page title is not persisted with the link, so tapping the link button again would show different information in the hybrid field

Are any of the remaining items considered "blockers" for this iteration? Thanks again for all your helpful guidance! 😄 👍

@mkevins
Copy link
Copy Markdown
Contributor Author

mkevins commented Jul 31, 2020

@iamthomasbishop
Copy link
Copy Markdown
Contributor

iamthomasbishop commented Sep 1, 2020

@dratwas Looking really good overall! A couple of tiny things:

Android-only

  • I'm seeing a weird issue when trying to submit the search query, where the keyboard hides but the sheet stays in place. (video).
  • Also in this video ⬆️ , you'll see when the link is applied on the block, the string is doubled somehow (screenshot). This happens every time you apply a link from the sheet.
  • We can probably use a slightly dimmer gray for the cancel icon (meaning lighter in light mode, darker in dark mode). (example using current $gray (left) and one shade lighter, $gray-lighten-10 (right))
  • Now that we are allowing the sheet to go up to the status bar and also not allowing the user to swipe down to dismiss, is it possible to remove the border-radii from the top left/right corners of the sheet so that it's more obviously "docked" to the top?

iOS-only

  • Would it make sense to try a more "standard" input style on iOS? For example, either the standard white background w/ a gray fill around it, or a gray-filled-background input style (examples). Do you have any thoughts or opinions on this @SylvesterWilmott ? It would def match our search input in the apps a bit more closely. If this is something we'd like to do, I can provide the exact colors.

@dratwas
Copy link
Copy Markdown
Contributor

dratwas commented Sep 2, 2020

Thanks for your feedback @iamthomasbishop! I made a list below to track all of your suggestions. Could you please take a look and answer to the questions i asked in section Need details? :)

Need details

  • Colors of the icon

We can probably use a slightly dimmer gray for the cancel icon (meaning lighter in light mode, darker in dark mode). (example using current $gray (left) and one shade lighter, $gray-lighten-10 (right))

  1. Is it Android-only thing?
  2. Could you please provide the color for the dark mode as well? :)
  • Issue with doubled link string

Also in this video ⬆️ , you'll see when the link is applied on the block, the string is doubled somehow (screenshot). This happens every time you apply a link from the sheet.

I can not see it on the video because the modal is open from the very beginning but - how you open the link settings?
Do you select the Link word and the open link settings or you open link settings, type title, select link and close the bottom-sheet? Asking because i can not reproduce it as well.

I tried something like this:
linkpickerandroid

In progress

  • Issue with empty bottom space

I'm seeing a weird issue when trying to submit the search query, where the keyboard hides but the sheet stays in place. (video).

Hmmm i haven't seen this before but finally, i reproduced that after a lot of switches between screens.

Done

  • Now that we are allowing the sheet to go up to the status bar and also not allowing the user to swipe down to dismiss, is it possible to remove the border-radii from the top left/right corners of the sheet so that it's more obviously "docked" to the top?

Need Decision

  • Would it make sense to try a more "standard" input style on iOS? For example, either the standard white background w/ a gray fill around it, or a gray-filled-background input style (examples). Do you have any thoughts or opinions on this @SylvesterWilmott ? It would def match our search input in the apps a bit more closely. If this is something we'd like to do, I can provide the exact colors.

@iamthomasbishop
Copy link
Copy Markdown
Contributor

Thank you @dratwas!

Is it Android-only thing?

The reason I put it under Android-only is that I think we're going to for-sure keep the current (in this build) input style, so I provided the color values w/ that in mind.

Could you please provide the color for the dark mode as well?

Sure thing! I took a look at our current color variables, and I think we can use the $dark-quaternary fill for the "clear" icon. Also, I noticed that on iOS dark mode, we aren't using the updated neutral gray on the icons (we're using one of the "old" blue-ish grays -- might currently be using either the standard light mode $toolbar-button or $gray variables, from the looks of it). Can we change that to use the standard gray, the same one we're using on the block toolbar icons (not exactly sure which color variable we are currently using)?

(Note: there are other places that we will also need to update, but while we're here, let's fix these instances on the sheet 😄 )

I can not see it on the video because the modal is open from the very beginning but - how you open the link settings?

Sorry the video might not have been super clear. The issue is happening at the same time as the keyboard-position issue -- when I have a link already. So to clarify, it's happening when I have an existing link, tap the "link to" cell to open the full sheet (to edit), then hit ✔️ on the keyboard ("done"). You'll see in the video that when I do this, the keyboard hides, the sheet transitions back to the top-level sheet, but its position isn't adjusted as the keyboard is dismissed and the string is doubled.

@dratwas
Copy link
Copy Markdown
Contributor

dratwas commented Sep 3, 2020

Sure thing! I took a look at our current color variables, and I think we can use the $dark-quaternary fill for the "clear" icon. Also, I noticed that on iOS dark mode, we aren't using the updated neutral gray on the icons (we're using one of the "old" blue-ish grays -- might currently be using either the standard light mode $toolbar-button or $gray variables, from the looks of it). Can we change that to use the standard gray, the same one we're using on the block toolbar icons (not exactly sure which color variable we are currently using)?

Yeah, i was surprised that the color is passed by the color prop but should be passed by the fill prop. I thought that it is intentional and didn't fix that :) Basically, it affects all Cells

@dratwas
Copy link
Copy Markdown
Contributor

dratwas commented Sep 7, 2020

Hey @iamthomasbishop :)
I created new builds with fixes except one with "double link string" since i couldn't reproduce that one.

Android

iOS

Could you please review it one more time? :)

@iamthomasbishop
Copy link
Copy Markdown
Contributor

iamthomasbishop commented Sep 9, 2020

@dratwas Got a chance to review again, thanks for the updated builds! Here are my notes:

  • I played around w/ the clear button a bit more in the flow and realized we might want to change the close/⬅️ action (on the sheet header) to cancel/X. For example, if I open an existing link and clear the URL, I expect that "close" button to basically discard the changes (and "Apply" to, well, apply). If there are any objections or complications that might come with this change, I'm all ears. // cc @SylvesterWilmott what do you think?

  • Only colors thing that I'm seeing is on Android: it looks like the clear icon is using a "stronger" gray than desired (iOS looks "right" in dark/light modes)

  • On Android, when the sheet is retracted (from full height to short), the transition/cross-fade looks a tiny bit choppy. I'm not sure if it's a performance issue or something else, bc I'm not seeing it on iOS. It's pretty subtle. (video of choppiness -- apologies in advance, it's a bit hard to see bc the video is low-resolution 😬 )

@dratwas
Copy link
Copy Markdown
Contributor

dratwas commented Sep 10, 2020

Hey, @iamthomasbishop thanks for this review :)

played around w/ the clear button a bit more in the flow and realized we might want to change the close/⬅️ action (on the sheet header) to cancel/X. For example, if I open an existing link and clear the URL, I expect that "close" button to basically discard the changes (and "Apply" to, well, apply). If there are any objections or complications that might come with this change, I'm all ears. // cc @SylvesterWilmott what do you think?

Done

Only colors thing that I'm seeing is on Android: it looks like the clear icon is using a "stronger" gray than desired (iOS looks "right" in dark/light modes)

Hmmm, I use the same color for both platforms (these ones you provided in previous comments )
Light mode : $gray-lighten-10
Dark mode: $dark-quaternary

Should I change them for Android? If yes, please provide correct values :)

On Android, when the sheet is retracted (from full height to short), the transition/cross-fade looks a tiny bit choppy. I'm not sure if it's a performance issue or something else, bc I'm not seeing it on iOS. It's pretty subtle. (video of choppiness -- apologies in advance, it's a bit hard to see bc the video is low-resolution 😬 )

On it, however, it doesn't happen every time, just sometimes, and is quite hard to find the root cause.

@iamthomasbishop
Copy link
Copy Markdown
Contributor

Hmmm, I use the same color for both platforms (these ones you provided in previous comments )

Interesting, here's what I'm seeing in the latest test builds:

On it, however, it doesn't happen every time, just sometimes, and is quite hard to find the root cause.

Yea, it's hard to pin down. It's a very subtle thing, if we need to create a separate ticket for it that's fine.

@dratwas
Copy link
Copy Markdown
Contributor

dratwas commented Sep 10, 2020

@iamthomasbishop

Interesting, here's what I'm seeing in the latest test builds:

Hmmm, weird... I'm pretty sure that the corners are not rounded when the bottom-sheet is in full height mode on Android latest build.

Latest build should looks like this:

Yea, it's hard to pin down. It's a very subtle thing, if we need to create a separate ticket for it that's fine.

Will spend some time on it tomorrow and if I fail I will create an issue

@iamthomasbishop
Copy link
Copy Markdown
Contributor

@dratwas ahh, I wonder if the build I tested on Android wasn't the latest. I'll try to update again and double check.

@iamthomasbishop
Copy link
Copy Markdown
Contributor

@dratwas Sure enough, I wasn't on the latest build. Colors look good on Android as well 👍

I'm still seeing the same actions in the sheet header -- to clarify, here's what I was trying to explain in my previous comment:

@iamthomasbishop
Copy link
Copy Markdown
Contributor

@dratwas Are you still unable to reproduce the "double-string" issue? I'm able to reproduce it with no issue. Steps:

  • Add text to a paragraph block
  • Select text, tap link button in block toolbar
  • Add URL (wordpress.org, for example), tap enter
  • See link text is doubled (with only the second string as a link)

Video

@dratwas
Copy link
Copy Markdown
Contributor

dratwas commented Sep 10, 2020

Hey @iamthomasbishop thanks for the exact steps to reproduce. I fixed it and generated a new build with the latest changes.

Android
iOS - PR

@iamthomasbishop
Copy link
Copy Markdown
Contributor

@dratwas @lukewalczak Just took the latest builds of iOS and Android for a spin, and I think it's looking good-to-go. I will spend some time next week documenting (in the form of a new GH ticket) the things we would like to attack in the next iteration — most importantly extending this UI/flow to other places that have link settings (image block, buttons, etc). Thanks y'all for all of the great work on this, stoked we're going to ship it!

@lukewalczak lukewalczak added this to the 1.38 milestone Sep 18, 2020
Copy link
Copy Markdown
Contributor

@geriux geriux left a comment

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Design Review Needs design review or sign-off before shipping [Type] Enhancement Improves a current area of the editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants