Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Comments on Handling too short comments padded with spaces

Post

Handling too short comments padded with spaces

+4
−0

When starting a new comment thread, the "Create thread" button is disabled until the content of the "Your comment" text box has at least 15 characters. This character count includes leading and trailing spaces. However, leading and trailing spaces are removed after pressing "Create thread", which can make the comment become too short to be accepted, not necessarily due to any fault of the user[1].

When this problem occurs when adding a new comment to an existing thread, a red error message is displayed above the thread, so the user can try again:

Box with red background and message saying "Comment is too short (minimum is 15 characters)"

This is helpful, but the original message is removed so rather than typing an extra character, the user has to type out the whole message from scratch.

There is a larger problem when creating a new thread (rather than adding a comment to an existing thread). Instead of a helpful red message, there is just a 422 error page and no text box for the user to try again. This gives no indication of what went wrong:

Large 422 followed by the text "UNPROCESSABLE Your request couldn't be processed"

I have 2 suggestions to improve the user experience:

  1. Introduce the same behaviour for new threads as currently exists for new comments in existing threads: A red message making clear what went wrong ("Content is too short (minimum is 15 characters)" rather than a 422 page), and a text box allowing the user to try again.
  2. When the user is given the opportunity to try again, provide the previously entered text so the user does not have to type it all out again.

Better still would be to measure the comment length in a consistent way so that the mismatch does not happen. This could be done by deciding whether to enable the button based on the comment text stripped of any leading and trailing whitespace, rather than based on the full comment text. This way any text accepted by the front end (browser) will also be accepted by the back end (server).

I would expect this to be easier to implement than the 2 suggestions shown above, and better for the user, but the other 2 suggestions might still need to be implemented for users with JavaScript disabled in their browser.


  1. In some cases this will be due to a user deliberately adding spaces to try to get around the 15 character minimum. However, this can also happen accidentally, particularly on mobile where the on screen keyboard adds a space after each word. A user may not always realise that their 14 character message has an automatically added space at the end bringing it up to 15 characters. ↩︎

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Even better, just lose those stupid minimums in the first place. (2 comments)
Even better, just lose those stupid minimums in the first place.
Olin Lathrop‭ wrote 9 months ago

Even better, just lose those stupid minimums in the first place.

trichoplax‭ wrote 9 months ago

Personally I'd be perfectly happy with reducing all the minimums to 1 character, but even if that decision was mine to make, we'd still need to deal with the case where someone accidentally submits a single space.