Page MenuHomePhabricator

Comment box in comment-driven voting ballot appears twice
Closed, ResolvedPublic

Description

For polls of type range voting (histogram range) with comment, the comment box appears twice. Testing reveals that both of these comments are stored with the vote itself (it is not, for example, only saving one or the other, but rather both), though this is suboptimal UX.

Screenshot 2022-01-25 at 4.06.37 PM.png (787×1 px, 52 KB)

In the above screenshot, anything submitted in either box is sent along with the vote, but it is not clear why there exist two boxes. Ideally one of them would be removed.

Event Timeline

jrbs triaged this task as High priority.Feb 7 2022, 6:17 PM

It looks like the boxes have two names, securepoll_comments_native and securepoll_comments_en, which might explain why there are two? It doesn't seem to matter what language my interface is in, it's always "en".

There's not really any mystery, at a technical level. It's been like that since the initial commit in 2011:

		// Add the comments boxes.
		$form .= Html::textarea( 'securepoll_comments_native', '',
			[ 'rows' => 10, 'cols' => 20 ] );
		$form .= Html::textarea( 'securepoll_comments_en', '',
			[ 'rows' => 10, 'cols' => 20 ] );

I could not find any documentation justifying that design decision, but it's likely that the intention was for the "native" box to hold comments in the user's native language, whereas the "en" box was intended for comments in English.

The code shows evidence of being developed in haste. There's no real reason to preserve decisions made there. The voting records for the image filter referendum were on SPI servers and apparently no longer exist, so there's no need for backwards compatibility.

I'd be interested to know what the reasoning was back then but right now, I think it makes sense to get rid of one of these boxes - probably the en one, though I don't think it would matter too much.

I guess the same reason (coded in a hurry in 2011) applies to T300088: Text `[comments]` is not customisable or translateable as well?

I think in an ideal world, a comment would be a type of Question, and we would allow different questions in an election to have different ballot types, so that you could have questions of the regular ballot types and any number of free text questions, at the end or interleaved. Any text like "comments" introducing the free text question would be in the localization of the question.

But that would probably take me a week, since it's a schema change and a distributed assumption throughout the code. It's more feasible to get rid of RadioRangeCommentBallot, and instead add an optional comments box to the end of every ballot.

Change 763396 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/extensions/SecurePoll@master] Add optional comment box to the end of the vote form

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

It's more feasible to get rid of RadioRangeCommentBallot, and instead add an optional comments box to the end of every ballot.

This is done in the patch above and now awaits review.

It's more feasible to get rid of RadioRangeCommentBallot, and instead add an optional comments box to the end of every ballot.

This is done in the patch above and now awaits review.

Belated thanks, Tim! I think this solution is excellent. I have a question about translatability of the comments box but I'll leave those in T300088

I don't want to trample on the process but is there a way to have this reviewed a little quicker given the vote is so soon?

Change 763396 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] Add optional comment box to the end of the vote form

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

jrbs assigned this task to tstarling.

@tstarling's patch went live with the train and looks great! Thank you!