qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Cannot type or paste beyond maximum length in a comment body

Open trichoplax opened this issue 4 months ago • 2 comments

Describe the bug When typing in a post body or post title or comment title field, there is a character counter showing how many characters have been used. This turns red if the maximum is exceeded. This is all correct. However, in a comment body field (whether starting a new thread or adding to an existing thread), no more characters can be added once the maximum has been reached. This is frustrating if the user wishes to compose their thoughts first, and then edit down to meet the maximum later. It can also lead to incorrect posting, as the silent failure may lead a user to think that text they pasted was successful. This is particularly easy to misinterpret because the pasting does not fail - pasted characters are added to the field up until the maximum is reached, and then the rest of the pasted characters are silently discarded.

To Reproduce Steps to reproduce the behavior:

  1. Go to a post and click "Start new comment thread" or "Reply to this thread" under an existing thread.
  2. In the "Your comment" or "Your message" field respectively, enter 1 less than the maximum number of characters.
  3. Paste a string longer than 1 character.
  4. See only the first character is added to the field, with no indication of failure.
  5. Press a key, and see it does not appear in the field, with no indication of failure.

Expected behavior The behaviour of comment fields should reflect the behaviour of post body, post title, and comment title fields.

trichoplax avatar Sep 16 '25 15:09 trichoplax

Yeah, it's an unfortunate side-effect of switching validation to proper validity state checks - without minlength and maxlength attributes, it will not trigger. It's not impossible to solve (will switch to pattern validation), though, just noting that it isn't as straightforward as it seems to be.

Oaphi avatar Sep 22 '25 23:09 Oaphi

Thanks for fixing my assumption. I'd thought that the other 3 cases working would make it just a matter of imitating them.

trichoplax avatar Sep 23 '25 02:09 trichoplax