Topic on VisualEditor/Feedback

Suggestion: Always show the checkbox when the boolean type is added in the template insert dialog

2
Summary by Whatamidoing (WMF)
197.218.90.67 (talkcontribs)

Issue:

The checkbox only appears if the template exists on a page with either value of 0 or 1.

Steps to reproduce:

  • Create a template "testbool"
  • Add the following to the template:
<noinclude><templatedata>
{
	"params": {
		
		"p1": {
			"type": "boolean"
		}
	}
}
</templatedata></noinclude>
test {{{p1}}}
  • Go to test page
  • Click insert template
  • Insert "testbool"
  • Add p1

Expected

A checkbox to select or deselect (or unset) a true / false parameter.

Actual

The interface presents a blank text box.

Proposed solution

  • Always show the checkbox with false as the default, and unset it (e.g.{{testbool}}) when the user
  • removes the parameter from the insert dialog

Alternate solutions

Notes: It was initially quite confusing that the value 1 or 0 must be set to see the checkbox. It took me quite a while to figure that out. Even setting the parameter default as 1 doesn't make the checkbox initially appear.

197.218.90.67 (talkcontribs)

One benefit of the alternative solution is that this would also resolve the problem discussed in Topic:Tiazyrpyuav76l53.

Having a tri-state toggleswitch would allow users to remove the template parameter by setting it to the third state (undefined). This in turn could be interpreted as either :

{{testbool|p1=}}

Or

{{testbool}}

The first is probably best for visualeditor because it would differentiate between someone adding a parameter and leaving it undefined, and someone never adding that parameter. Although the second example would probably be preferred by editors.