Page MenuHomePhabricator

Implement title field validation
Closed, ResolvedPublic

Description

This task about adding feedback to the New Discussion Tool that causes people to easily become aware of the following when they attempt to publish a new discussion topic without having added any text to the tool's Topic field:

  1. The Topic field is empty
  2. In most cases, the topic field should contain a title for the topic the author is wanting/trying to discuss

Behavior

  1. Open the New Discussion Tool
  2. Enter some text in the tool's Description field
  3. Click the Add topic button

Existing

  1. ❗️Notice what you wrote in "Step 2." is published to the talk page and placed within the bottom-most section

Desired

  1. ✅Notice feedback [of some kind] causes people to know:
    • The Topic field is empty
    • In most cases, the topic field should contain a title for the topic the author is wanting/trying to discuss
  2. ✅Click Add topic button
  3. ✅ Notice what you wrote in "Step 2." is published to the talk page and placed within the bottom-most section

Approach

Follow the OOUI guidelines:

Screen Shot 2021-01-12 at 9.14.48 AM.png (398×738 px, 51 KB)

Fix the focus states and potential bug for now. In the future I would like us to shoot for moving from soft validation to hard validation.

Background

In T243248#6514134, we decided to initially implement soft vs. hard validation.

Thank you to @Tacsipacsi for mentioned this missing soft validation in T267595#6663423.

Done

  • An "Approach" for the "Desired" behavior is decided upon
  • An "Approach" for the "Desired" behavior is implemented

Event Timeline

Done in patchset 15 of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/623117 (it's easier for me to keep these in one change)

New demo wiki: https://patchdemo.wmflabs.org/wikis/6307a9de3d522c12e7daaa1bb7904435/w/index.php/Talk:Main_Page

Just a strawman idea. Using the default styling for warning messages, which – by the way – I think looks awful.

image.png (2×3 px, 323 KB)

  • @matmarex: are you able to adjust this patch such that the feedback is only surfaced when people click the Add topic button and the Topic field is emty.

As it's currently been implemented, the feedback message appears as soon as you switch your browser's focus from the Topic field to the Description field without having written anything in the former:

Screen Shot 2020-12-03 at 9.24.27 AM.png (776×2 px, 100 KB)

Just a strawman idea. Using the default styling for warning messages, which – by the way – I think looks awful.

Noted. I'll hold comments on styling accordingly.

This new version looks surprising for me. When I press the Add topic button, I’m focusing on that area, and not the title area. If I didn’t know what to expect, I would’ve probably never noticed the warning. A popup would be more natural for me, with language like:

You’re about to post the topic without a title. This will make your topic part of the previous topic. Are you sure?
Post without title Add title

When posting from wikitext mode the second sentence could even be (if possible)

This will make your topic part of the previous topic unless there is a topic title specified in the message body.

as custom preloads often produce section headers.

Lookin good. The feedback is now being shown at the desired point in the workflow.[i]


i. T269285#6667277: "...when people click the Add topic button and the Topic field is empty."

This new version looks surprising for me. When I press the Add topic button, I’m focusing on that area, and not the title area. If I didn’t know what to expect, I would’ve probably never noticed the warning. A popup would be more natural for me...

This is helpful feedback, @Tacsipacsi. We are planning to think about the implementation of the "feedback" now that the validation is occurring at the proper point in the flow (when someone clicks Add topic).

For additional context: what's been implemented in the patch linked in a comment above [i] does not represent how and where we think the feedback should be surfaced.[ii]


i. https://patchdemo.wmflabs.org/wikis/3efc07ef4b3bd33a019638283165e60f/w/index.php/Talk:Main_Page
ii.

Just a strawman idea. Using the default styling for warning messages, which – by the way – I think looks awful.

Next steps

  1. Possible bug? Validation state not cleared when widget is closed. I tried to add a new topic, I got the warning message, cancelled out, started a new topic and the warning message was still present.
  1. The topic field should be in focus when the warning state appears.
  1. In the future (read: DO NOT IMPLEMENT THIS NOW) we should use the red (stop sign) FieldLayout with error, and make the button inactive if the Topic is not written in the appropriate field.

Here's the OOUI guidelines:

Screen Shot 2021-01-12 at 9.14.48 AM.png (398×738 px, 51 KB)

  1. Possible bug? Validation state not cleared when widget is closed. I tried to add a new topic, I got the warning message, cancelled out, started a new topic and the warning message was still present.
  1. The topic field should be in focus when the warning state appears.

Thanks, both fixed in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/623117 patchset 37.

Great spots in T269285#6739765, @iamjessklein. Marking the two open actions below as "Done."

Before that a nit for @matmarex:

  • Can you please make it so the noun we are using in the warning message always matches the helper text in the Subject field? Currently, the two do not match: the helper text in the Subject field reads Topic and the text in the warning message refers to said field, and its contents, as the title.

Next steps

Change 655950 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Consistent wording in the warning message for missing new discussion topic

https://gerrit.wikimedia.org/r/655950

Change 655950 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Consistent wording in the warning message for missing new discussion topic

https://gerrit.wikimedia.org/r/655950

matmarex added a project: Editing QA.

Can be tested on the Beta Cluster, after enabling the beta feature in preferences.

Checked this on Beta cluster. Found the following issues:

T272535, T272543 and T272545.

Also adding them as subtasks to this parent ticket.

Note: Please don't mark this as resolved until all the sub-tasks are resolved and verified.