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

Add @username suggestions to notification and reader full comment view. #10781

Conversation

hafizrahman
Copy link
Contributor

Fixes #10328

To test:

On notification area

  1. Go to Notifications tab.
  2. Select Comments tab.
  3. Find a comment to a site of yours that's on WordPress.com, tap it.
  4. Tap Reply field.
  5. Enter @ followed by username of site user or the commenter, assuming they're WordPress.com accounts.
  6. Notice username suggestions are shown (this is already working prior to this PR, but just to check).
  7. Delete text from Reply field.
  8. Tap Expand action in Reply field.
  9. Enter @ followed by username of site user or the commenter, assuming they're WordPress.com accounts.
  10. Notice username suggestions are now shown.

On reader area

  1. Go to Reader tab.
  2. Find a WordPress.com site post, probably easiest if it's your own test site.
  3. Tap the comment icon on that post.
  4. Tap Reply field.
  5. Enter @ followed by username of site user or the commenter, assuming they're WordPress.com accounts.
  6. Notice username suggestions are shown (this is already working prior to this PR, but just to check).
  7. Delete text from Reply field.
  8. Tap Expand action in Reply field.
  9. Enter @ followed by username of site user or the commenter, assuming they're WordPress.com accounts.
  10. Notice username suggestions are now shown.

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@shiki Question about that last checkbox above, is this change something that warrants being added to RELEASE-NOTES.txt?

@shiki shiki added the Comments label Nov 14, 2019
@shiki shiki self-requested a review November 14, 2019 23:38
@shiki shiki added this to the 13.7 milestone Nov 14, 2019
Copy link
Member

@shiki shiki left a comment

Choose a reason for hiding this comment

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

Thank you, @hafizrahman for working on this.

It looks like there is a bug in the suggestions view. To reproduce:

  1. Show the full-screen comment view
  2. Add a few lines
  3. Add @ to show the suggestions list

The suggestions list is always shown at the top:

I'm not quite sure what's causing it but I think it should be fixed.

@hafizrahman
Copy link
Contributor Author

hafizrahman commented Nov 16, 2019

It looks like there is a bug in the suggestions view.

@shiki Thanks for reviewing things! As for this part, it seems like the dropdown generated by AutoCompleteTextView can only be set on a certain x,y location, or be anchored to a certain view. As far as I can tell, its position can't be set dynamically depending on the current triggering string cursor's location (so it can't show up right above / bottom the @... text, for example).

Here's the Stack Overflow link that was my starting point for the research.

In this case I think the current positioning at the top is already the ideal compromise, it will remain viewable and selectable regardless of the current text cursor position.

@hafizrahman
Copy link
Contributor Author

hafizrahman commented Nov 16, 2019

Found a bug where if there's multiple suggestions shown in the dropdown, it's only displaying one and the rest is kind of hard to see:

Showing only first result:

Screen Shot 2019-11-16 at 15 55 44

Second result only shown after scrolling:

Screen Shot 2019-11-16 at 15 56 01

@jkmassel
Copy link
Contributor

Howdy folks! I'm freezing 13.7 today, so this is being bumped to 13.8. If you'd like it to go out as part of 13.7, please target release/13.7 for this PR, and DM me once it's merged – I'll be happy to cut a new beta release!

@jkmassel jkmassel modified the milestones: 13.7, 13.8 Nov 18, 2019
@shiki
Copy link
Member

shiki commented Nov 27, 2019

Design Review Request

Hi Design Team! 👋 I was wondering you could give some inputs on this. Currently, the dropdown will always be shown at the top even if the cursor is somewhere in the bottom (#10781 (review)). Is there an existing design within the app that we can follow?

I spent some time to look at whether we can follow the cursor position. It seems quite challenging. 🤔

@shiki shiki added the [Status] Needs Design Review A designer needs to sign off on the implemented design. label Nov 27, 2019
@osullivanchris
Copy link

@shiki Hey thanks for the ping. Strange, I was thinking I would really like to have it next to the cursor. However I think if its fixed to something, I think fixed to the keyboard can work really well.

In the left of this sketch, the suggestion box appears above the keyboard. There is an item cut off to indicate its scrollable.

On the right: I know that we can't make it dynamic depending on cursor position. But can we make it dynamic depending on the total amount of content? So that more of the list is visible when the space is available and its always close to what you're writing?

Last note - in the sketch I have drawn this full width as I think it can work nicely with the keyboard and feel more natural to scroll within. Not sure if that is easy or problematic with this component.

Keep me in the loop!

IMG_1546

@shiki
Copy link
Member

shiki commented Nov 29, 2019

Thank you, @osullivanchris! Making it full width and fixing it to the keyboard sounds doable. I've seen other apps doing something similar. Making the height dynamic could be a nice-to-have but we can attempt it.

@jkmassel
Copy link
Contributor

jkmassel commented Dec 3, 2019

We're freezing 13.8 today, so I'm moving this forward to 13.9. If you'd like it released as part of 13.8, please adjust the target from develop to release/13.8, and let me know once this PR has been merged – I'll be happy to ship a new release candidate!

@jkmassel jkmassel modified the milestones: 13.8, 13.9 Dec 3, 2019
@shiki shiki removed this from the 13.9 milestone Dec 3, 2019
This uses a thin dummy view that sticks to the bottom of the screen, to which the suggestion dropdown can be anchored to.
@hafizrahman
Copy link
Contributor Author

@shiki I added some layout fixes to make the suggestion drop down stick to the bottom. This also fixed the bug I mentioned above as far as I can check.

Some screenshots:

  1. When the mention is at the top:
    Screenshot_1576826851

  2. When the mention is in the middle of the comment and showing multiple mentions:
    Screenshot_1576826912

  3. When the mention is in the middle of the comment and there's only one result:
    Screenshot_1576826922

@osullivanchris
Copy link

Thanks @hafizrahman looks much better! Nice job

@shiki shiki added this to the 14.0 milestone Jan 7, 2020
Copy link
Member

@shiki shiki left a comment

Choose a reason for hiding this comment

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

Great work, @hafizrahman!

I just wanted to note that the dropdown can cover the whole text view if there are so many suggestions.

We could use android:dropDownHeight="SOMETHING_DP" for this but I think it doesn't matter because if the cursor is at the bottom of the text field, it will still get covered.

That said, we're limited to the current architecture for this. To fully achieve the suggestion in #10781 (comment), we would probably need to concoct our own custom views. I believe what we have here is already great enough.

app:layout_constraintTop_toTopOf="parent"
android:dropDownAnchor="@+id/dummy_hidden_view" />

<View
Copy link
Member

Choose a reason for hiding this comment

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

That's really smart. 👍

@shiki shiki merged commit d8c4e9a into wordpress-mobile:develop Jan 7, 2020
@theck13 theck13 mentioned this pull request Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Comments [Status] Needs Design Review A designer needs to sign off on the implemented design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show Suggestions in Expanded Comment
4 participants