WordPress-Android icon indicating copy to clipboard operation
WordPress-Android copied to clipboard

[JP Social/Message] Text field in message edit screen can get over max length

Open thomashorta opened this issue 1 year ago • 0 comments

The first message set to the text field in the share message edit screen is the post title. That field has a maximum length controlled by the onValueChange callback of the OutlinedTextField, but that callback is not triggered when the text is set by us when the Activity opens.

The problem with this is: if the post title is longer than the maximum length, we are setting it to the text field anyway. As soon as the user tries editing the message it is truncated as expected, but there was an instance of a single crash regarding Accessibility that might be related with that bug.

https://github.com/wordpress-mobile/WordPress-Android/assets/5091503/63c00ac7-aa4a-48d6-90e2-3963be7f736a

Expected behavior

Right now when we have an empty message we default to the post title, and, at the very least, I would expect the post title to be truncated to the share message max length.

Another possible expectation would be having the field empty with some info saying the title will be used as default, which seems to be the current backend behavior, but that might be risky since we don't know if the backend truncates the title, nor if that behavior could change.

Actual behavior

The message field is set with the full post title, even when it's longer than the max length, and when the user types something in the field, it truncates to the proper maximum length.

Steps to reproduce the behavior

Have an account with JP Social configured and at least 1 social connection.

  1. Open Jetpack
  2. Create a new post
  3. Use a really long title (over 255 characters)
  4. Tap publish
  5. Tap the Social item
  6. Tap the message option
  7. Verify the message has the full title
  8. Type in the field
  9. Verify the message was truncated to the max-length (255 chars)
Tested on emulator, Android 13, JPAndroid 23.0-rc-1/trunk

thomashorta avatar Aug 21 '23 14:08 thomashorta