Page MenuHomePhabricator

New input for undocumented parameters
Closed, ResolvedPublic0 Estimated Story Points

Description

Background:
As a part of making working with templates in Visual Editor easier, we will change the way in which parameters can be discovered, added and removed from a template invocation. In this ticket, the add parameter/add more information button is removed from the adv toolbar since this feature is not related to editing multi-part content. The ability to add undocumented parameters remains intact, but is only shown in the situations where it's most useful: when a template does not have documented parameters and/or they cannot be autogenerated, or if a template invocation already has a mix of documented and undocumented parameters. If users know the names of the parameters within the template, they can use this component to add fields for them.

We are removing the old component because it has a lot of search functionality and results display that is not needed anymore (all parameters are visible in the side bar and it has its own search there). The only function still needed is the ability to add an undocumented parameter, so we've decided to use an input field better suited to this need.

Requirements

Remove previous component (hide behind feature flag):

  • Remove the "Add more information" ("add parameter/add undocumented parameter" on the test instance) option from the adv toolbar (param icon) (if not done already)
  • Remove the existing "Add more information" component (if not done already)

New component:

  • Use OOUI component layout "ActionFieldLayout aligned top" to add an input for adding undocumented parameters with a progressive button
  • Give this new input a label with the parameter icon, and a description below.
  • All links open in new tabs
  • This input should be visible or hidden based on the situation. It cannot be shown or hidden by the user, but is shown automatically there when these requirements are met:
    • Show when a template is missing TemplateData and parameters cannot be autogenerated (inserting or editing)
    • Show when the template invocation already includes at least one undocumented parameter (editing existing invocation only)
    • Show when a template has TemplateData but no documented parameters (inserting or editing)
    • Otherwise, hide the input.
  • When shown, this input should be closed by default (only title shown) - see mocks below.
  • Title is a ButtonWidget (quiet) and when clicked shows the description and input field. When clicked again it closes and shows only the title.
    • When closed the icon is the OOUI 'add' icon
    • When open the icons is the OOUI 'subtract' icon
  • Input does not disappear from the content pane when parameter filtering is used.
  • Input is visible only in the main content area and does not have a side bar element/title.

Order of components and added content:

  • If shown, as per requirements above, the undoc param input should should always be at the bottom of that template's content in the right side of dialog.
  • After clicking to add a parameter, add to the template above the input, which remains visible below it. Show the added parameter in the sidebar as a selected checkbox.
  • Undocumented parameters, after being added to the template, are shown in alphabetical order (existing behavior)

Mocks

Closed (default)Open
Undoc params - closed.png (667×901 px, 20 KB)
Undoc params-updated wording.png (667×901 px, 34 KB)

Note: message at top of mock is not added in this ticket. Will be added in T276574: Add reactive notices and warnings in VE template dialog

Text
Title "Add undocumented parameter"
Description: If known, enter undocumented parameter names. Note that only parameters known by the template will have an effect. You may find information about existing parameters on the [[template’s page]].
Input placeholder: Parameter name
Button: Add parameter

Related tickets:

Related Objects

StatusSubtypeAssignedTask
ResolvedWMDE-Fisch
ResolvedLena_WMDE
ResolvedLena_WMDE
ResolvedWMDE-Fisch
ResolvedWMDE-Fisch
ResolvedECohen_WMDE
ResolvedWMDE-Fisch
Resolvedawight
DeclinedNone
ResolvedNone
InvalidNone
Resolvedthiemowmde
Resolvedlilients_WMDE
InvalidNone
Resolvedthiemowmde
ResolvedAndrew-WMDE
ResolvedAndrew-WMDE
ResolvedNone
ResolvedNone
Resolvedthiemowmde
ResolvedAndrew-WMDE
ResolvedWMDE-Fisch
ResolvedLena_WMDE
ResolvedNone
Resolvedawight
ResolvedAndrew-WMDE
InvalidNone
Resolvedthiemowmde
Resolvedawight
ResolvedBUG REPORTWMDE-Fisch
ResolvedBUG REPORTthiemowmde
ResolvedBUG REPORTthiemowmde
ResolvedWMDE-Fisch
DuplicateBUG REPORTNone
ResolvedECohen_WMDE
InvalidNone

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Lena_WMDE set the point value for this task to 8.Aug 4 2021, 1:50 PM
Lena_WMDE removed a project: Epic.

I suggest that we update the metrics, to record a new event type "show undocumented param input" so we get an idea of how often this logic is triggered.

I suggest that we update the metrics, to record a new event type "show undocumented param input" so we get an idea of how often this logic is triggered.

This sounds useful, particularly as a percentage of total opens since that would help us verify the assumption that this is not common. Esp since we might be increasing its frequency significantly by showing this for templates with TD but without parameters.

Would be nice to put with the related metric we are tracking about how many undocumented parameters are added per open (does this needed to be edited to be per open when input is shown?)

@Lena_WMDE what do you think?

Change 710527 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/VisualEditor@master] [WIP] added new input field for undocumented parameters

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

@ECohen_WMDE I wanted to highlight an interaction with T288202: Parameter search also filters main content area: when the content area is being filtered, the undocumented parameter entry is hidden. This feels like an accident, can you confirm the intended behavior?

Filtered:

image.png (549×978 px, 64 KB)

Normally:

image.png (553×984 px, 60 KB)

I suggest that we update the metrics, to record a new event type "show undocumented param input" so we get an idea of how often this logic is triggered.

This sounds useful, particularly as a percentage of total opens since that would help us verify the assumption that this is not common. Esp since we might be increasing its frequency significantly by showing this for templates with TD but without parameters.

Would be nice to put with the related metric we are tracking about how many undocumented parameters are added per open (does this needed to be edited to be per open when input is shown?)

@Lena_WMDE what do you think?

Agree this would be useful to confirm that the input is rarely needed/used. In that case it would probably also be useful to link it to successful saves.

I wanted to highlight an interaction with T288202: Parameter search also filters main content area: when the content area is being filtered, the undocumented parameter entry is hidden. This feels like an accident, can you confirm the intended behavior?

@awight Good catch! Didn't think about how these would interact now that we changed that behavior. I think you're right it makes sense if that remains visible - no matter which parameters are being filtered or not.

I think you're right it makes sense if that remains visible - no matter which parameters are being filtered or not.

Thanks for the confirmation—I've added to the acceptance criteria.

Heads up - design change coming but I'm still working out the details. Would like to discuss the technical complexity (or hopefully not!) of this change. Sorry for the last minute nature, just had the idea but think it has the potential to be a big improvement since we are now showing this input in significantly more situations (based on the decision to show when no params are documented, even if a template has TD).

The idea is to show only the title instead of the full component, then when clicking the title the full component appears. Clicking again would hide the input. Still figuring out if adjusting the look/icon of the title would help users understand how this works. Mocks coming!

A few reasons for the change:

  • Because no parameter templates are actually quite common, there are many situations where this component is shown but probably shouldn't be used. When it's fully visible, it's likely that users think there is something for them to do/add before they fully understand the situation. Having to click on the 'Add undocumented parameter' button is more intentional and probably more likely to be done by someone who knows what that is/what they need to do. Hopefully this minimizes confusion.
  • Cleans up the number of components visible. This could be particularly important for multi-part template content.
  • This is actually similar to the way the existing "Add more information" component works.

Not final mocks to demonstrate the idea:

On openOn clicking title/button
Screen Shot 2021-08-10 at 17.26.19.png (352×576 px, 22 KB)
Screen Shot 2021-08-10 at 17.26.24.png (434×572 px, 37 KB)

Would like to discuss the technical complexity (or hopefully not!) of this change.

This adds very little technical complexity, no worries!

This adds very little technical complexity, no worries!

That's great news!

Change 712931 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Add isDocumented() feature to ve.dm.MWTemplateSpecModel

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

Change 712931 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add isDocumented() feature to ve.dm.MWTemplateSpecModel

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

Change 713603 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Remove addParameter button from new sidebar

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

Change 713603 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Remove addParameter button from new sidebar

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

Change 713628 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Remove parameter adding whith new side bar

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

Change 713631 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Add getters for un-/documented paramters

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

Change 713633 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Merge if clause when adding template page

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

Change 713636 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Re-add adding undocumented paramters in some cases

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

Change 713631 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add getters for un-/documented parameters

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

Change 713628 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Remove parameter adding on new sidebar code

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

Change 713633 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Refactor onReplacePart in TemplateDialog

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

Change 710223 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Streamline and harden template paramter search widget behavior

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

Change 710223 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Streamline and harden template paramter search widget behavior

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

Change 713636 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Re-add adding undocumented paramters in some cases

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

I find the help text difficult, it feels too specific to the use case where a template takes an explicit parameter, and the parameter could not be auto-detected or was left out of the documentation by mistake. It's the word "existing" that causes me to understand in this way, it looks like an additional concept to understand. This wouldn't be quite the right explanation for templates with e.g. numbered parameters like param10, or that forward all parameters to something else without a defined contract.

An example of how I would change the text:

If known, enter undocumented parameter names. If the parameter is not used by the template, adding it will have no effect. You may find parameter documentation on the [[{{ns:template}}:$1|template’s page]]."

(just noticed that the mock includes a help link for "undocumented parameter", hopefully this was dropped intentionally?)

I have to say the wording "existing undocumented" confused me as well. The in my opinion most relevant use-case is when a template is documented, just not machine-readable via TemplateData. In this case the user needs to visit the template's page to find out which parameters the template accepts.

Suggestion: "You can enter parameter names you know the template accepts. Note that only parameters known by the template will have an effect. Please check the documentation on the template’s page."

Change 714363 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Fixes and cleanups to new add parameter input widget

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

Change 710527 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Added new input page for undocumented parameters

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

Change 714363 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Minor cleanups to new add parameter input widget

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

Change 715015 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Use spec label for template link generation

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

Change 715015 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Use spec label for template link generation

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

I've updated the task description and the mock to show the new description based on @awight and @thiemowmde 's feedback. It removes the phrase "existing undocumented parameters" and also removes the double negative from the second sentence:

If known, enter undocumented parameter names. Note that only parameters known by the template will have an effect. You may find information about existing parameters on the template’s page.

(just noticed that the mock includes a help link for "undocumented parameter", hopefully this was dropped intentionally?)

Correct, this cannot be implemented yet because the documentation to be linked to has not been added to the meta help page yet.

Also after looking on beta, a few notes for the styling:

Screen Shot 2021-08-27 at 10.55.31.png (1×1 px, 383 KB)

  • Please match the margins for the input component and parameters
  • Please match the input's description text styling to the parameter description text styling

I also noticed a possible bug. After adding a parameter, it did not add to the bottom of the list but before the already added undoc param:

Screen Shot 2021-08-26 at 13.25.34.png (844×1 px, 150 KB)

Was testing here: https://en.wikipedia.beta.wmflabs.org/wiki/Linux?action=edit

I also noticed a possible bug. After adding a parameter, it did not add to the bottom of the list but before the already added undoc param:

I think this is correct. We alphabetize the unknown params, rather than show them in the order added or in the order given in the template invocation. (Note that when serialized, the template invocation order / order added are preserved.)

I think this is correct. We alphabetize the unknown params, rather than show them in the order added or in the order given in the template invocation. (Note that when serialized, the template invocation order / order added are preserved.)

Oh I see! I wasn't part of the sprint review where this was discussed. Feel free to ignore the 'bug report' part of my comment then!

I think this is correct. We alphabetize the unknown params, rather than show them in the order added or in the order given in the template invocation. (Note that when serialized, the template invocation order / order added are preserved.)

Oh I see! I wasn't part of the sprint review where this was discussed. Feel free to ignore the 'bug report' part of my comment then!

Thanks for the confirmation, we'll go ahead with the current order. We have the ordering implemented in a single place, so please feel free to reopen the question any time, it wouldn't be difficult to switch logic in the future.

Change 715537 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Correct focus handling when adding undocumented parameters

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

Change 715537 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Correct focus handling when adding undocumented parameters

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

thiemowmde moved this task from Demo to Done on the WMDE-TechWish-Sprint-2021-08-18 board.

This still needs the text updated from the comment above: T272487#7314421

@ECohen_WMDE, is this also part of T276574? It looks like the second row in the table over there is about this message. Should it be updated?

@ECohen_WMDE, is this also part of T276574? It looks like the second row in the table over there is about this message. Should it be updated?

No the message in that ticket is something else.

Change 715713 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Update text for unkown parameter input

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

Change 715713 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Text improvements for unkown parameter input

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

WMDE-Fisch changed the point value for this task from 8 to 0.

Finished in 2021-08-18 sprint.

Change 715938 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Fix \u2026TemplateSpecModel reporting missing pages as documented

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

Change 715962 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Mark link to non-existing template page red

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

Change 715938 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Fix \u2026TemplateSpecModel reporting missing pages as documented

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

Change 715962 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Mark link to non-existing template page red

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