The page title component is used for strings that represent a MediaWiki page title. The component is supposed to make it easier to select a title by providing a dropdown menu with suggestions and providing page title-specific validation rules. However, as of now, it is very easy to accidentally blank the page title, while trying to change it. For example, in https://en.wikipedia.org/w/index.php?diff=1236433907, @Pppery accidentally dropped the page title for all help panel links, while the intention was to change the set of links to a partially different one (see the follow-up fix, as well as a combined diff of both edits).
As of writing, the page title component requires the user to explicitly select an item from the dropdown menu for the change to take effect. If no item is selected, then the page title component blanks the page title instead (and in T370326, we decided to represent blanking as an empty string), regardless of the user-provided text that is within the component. This property of the component presumably led into the accidental blanking. The current behaviour of the component can be seen in the two attached screencasts:
Not selecting any suggestion (edit failed) | Selecting one of the suggestions (edit successful) |
This problem can be fixed in several different ways:
- Respect user-provided text input at all times: We can make the dropdown a suggestion-only tool. It provides suggested titles as the user is typing, but the user-provided input is final. In other words, whatever the user types out will be saved into the configuration, regardless of whether it matches any of the suggested titles.
- Replace user-provided textual input with the to-be-saved configuration upon exiting the field: Alternatively, we can ensure the text input matches what would be saved upon clicking Save. In other words, if the user would leave the component without selecting anything, the user-provided input would disappear (possibly with a notification to the user), leaving it up to the user to go back and fix the config, or deliberately hit Save if blanking was the user's intention.
- Include visual guidance that the current user input will be ignored: Instead of emptying the user input (forcing the user to type the input out again), we can add visual indication that it will not be used. This is the approach that Special:Block follows for page-based restrictions (upon exiting the Pages input control with a non-existent page, the input control is rendered in red, see F56763484, making it clear something is wrong in there; upon submission, the invalid user input is silently ignored [block may or may not get placed, depending on whether the user provided any other restrictions).
Within this task, we should decide which one of those two solutions should be used. Then, a follow-up engineering task should be filled to implement the decision.