WordPress-Android
WordPress-Android copied to clipboard
[JP Social/Message] Text field in message edit screen can get over max length
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.
- Open Jetpack
- Create a new post
- Use a really long title (over 255 characters)
- Tap publish
- Tap the Social item
- Tap the message option
- Verify the message has the full title
- Type in the field
- Verify the message was truncated to the max-length (255 chars)