Page MenuHomePhabricator

Rethink the behavior of mw.widgets.CategorySelector when invalid title is entered
Open, MediumPublic

Description

We should think about the behavior of mw.widgets.CategorySelector when invalid title is entered a bit. Currently, if you type e.g. "A|B", pressing Enter does nothing and moving keyboard focus away from the field makes the text disappear. Not very user-friendly.

We shouldn't let the text just stay there though, since it is not really "accepted" until it turns into a capsule. Allowing the text to remain, with no other changes, would be even worse (it would lose the user input just the same, but at a later stage when the user can't fix it).

Discussed here: https://commons.wikimedia.org/wiki/Commons:Village_pump/Archive/2016/09#Category_changes_in_Wizard...

Thoughts:

  • Just accept the input, and make the code that uses CategorySelector deal with the invalid value?
  • Display a text warning when typing?
  • Mark the field as 'invalid', but don't remove the entered text?

(Tagging with Multimedia, since our upload tools are the primary place where this is used right now.)

Event Timeline

Just accept the input, and make the code that uses CategorySelector deal with the invalid value?

This makes sense, but it might confuse the user to see that the category didn't actually get added. Maybe, when we add the token for it we should mark it invalid in some way, a white text on red background or something?

Display a text warning when typing?

Something like an inline label on a TextInputWidget would be nice.

Mark the field as 'invalid', but don't remove the entered text?

Hm. Currently there is no way for a CapsuleMultiselectWidget to be invalid, right?

MarkTraceur subscribed.

Since this is a tool to enter a particular form of wikitext, I think it's sane to expect the widget to validate that wikitext instead of the downstream code. I like the text warning option best.