openstreetmap-website icon indicating copy to clipboard operation
openstreetmap-website copied to clipboard

Added indicator message preview is empty.

Open nenad-vujicic opened this issue 1 year ago • 9 comments

This PR addresses "Indicate if the message preview is empty" issue mentioned in the #3748

Added check in Preview button click event handler if body (message, diary entry, diary comment) is empty and if positive, performs reporting validity (displays tooltip). Fixes #3748.

image

nenad-vujicic avatar Jun 14 '24 08:06 nenad-vujicic

Github's "Nothing to preview" is not ideal because it looks exactly as if you wrote a message "Nothing to preview".

AntonKhorev avatar Jun 14 '24 11:06 AntonKhorev

Maybe we should just disable the preview button when there is nothing to preview?

tomhughes avatar Jun 14 '24 16:06 tomhughes

I was thinking about alert to make "Nothing to preview" look different. With a disabled button users have to figure out why it's disabled.

AntonKhorev avatar Jun 14 '24 16:06 AntonKhorev

I have a branch with tabs by the way:

image

image

AntonKhorev avatar Jun 14 '24 16:06 AntonKhorev

Dear @AntonKhorev , @tomhughes ,

I updated the sources to trigger validation and error reporting like when pushing Send / Publish (like on above screenshot). Please, let me know if it looks fine now or if I can improve it somehow.

Thanks, Nenad.

nenad-vujicic avatar Jun 20 '24 09:06 nenad-vujicic

Is it necessary to have an "Add subject" placeholder right under a "Subject" label? Maybe you can argue that the "Body" label is not clear enough, but then why is the placeholder "Add your message" even for diary entries? And what does all of this have to do with the issue #3748?

AntonKhorev avatar Jun 24 '24 15:06 AntonKhorev

I updated the sources to trigger validation

It also validates the subject and will tell to fill out the subject if its empty while not saying anything about the body. Does that make sense when the user asks for a preview of the body?

AntonKhorev avatar Jun 24 '24 15:06 AntonKhorev

Dear @AntonKhorev ,

Thank you very much for reviewing and comments. I removed placeholders (probably overkilling, also not used on other places in website) and updated JavaScript to force checking body only when pushing Preview button.

Please, let me know your thoughts and if I can improve it further somehow.

Thanks, Nenad.

nenad-vujicic avatar Jun 27 '24 18:06 nenad-vujicic

Dear @AntonKhorev ,

Thank you very much for your review & suggestion. When I was trying reportValidity(), I forgot to put preventDefault() before :-).

I used validation because checking Subject / Body when pushing Send / Publish / Update used validation. What is the ideal solution here, using validation or bootstrap alerts?

Thanks, Nenad.

nenad-vujicic avatar Jul 01 '24 04:07 nenad-vujicic

Added alternative (#5023) using bootstrap alerts

nenad-vujicic avatar Jul 26 '24 15:07 nenad-vujicic

Closed in favor of #5023

AntonKhorev avatar Aug 04 '24 16:08 AntonKhorev