Page MenuHomePhabricator

Function Editor: Decide on + implement the behavior of clearing a selected language
Closed, ResolvedPublic

Description

On the function editor, if you clear a selected language box the option for that language still remains in the Work Summary [1].

This has issues because

  1. The editing page becomes out of sync with the Work Summary
  2. Because already selected languages are not available in the drop-down options, a previously selected language becomes un-selectable.

If it is decided that clearing the selection box shouldn't remove it as a created option, we will need to address 2) as a bug.

[1]

Screen Shot 2022-08-30 at 6.36.56 PM.png (1×2 px, 708 KB)

Event Timeline

I think this should be considered a bug.

Clearing the language in the editor should update the underlying ZObject data representation, and whatever is shown in the work summary should be a faithful representation of that ZObject. We should be always treating the root ZObject in the table structure as our only source of truth.

Also when you select another language, the previously selected language still appears at the right corner (work summary), and you cannot select again this language in the function definition.

Steps to reproduce:

  1. Go to the function creation page
  2. In the function definition, change the language to German
  3. In the work summary, expand the combobox => you can still see the English language in the combobox
  4. In the function definition, attempt to select the English language anew => you cannot.
Teleosteen subscribed.

I tried to understand how the store works to bind the languages of the FunctionDefinition and the FnEditorVisualDisplay, and have to admit to have failed on this.

I unassign myself from this task.

Change 830125 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Function-editor: Keep languages of the editor in sync with the root zObject, and therefore the Work Summary.

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

Change 831619 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Function Editor: Language Selector Changes: 1) Align new function and existing function editor views by removing "read only" view from the latter. 2) Do not allow for clearing of a selection box, by falling back to last selected lang if new selection not made. 3) Ensure Work Summary stays in sync with the editor. Ie. if a language is changed, the old language is deleted, and the new language is selected.

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

Change 830125 abandoned by Dani DW:

[mediawiki/extensions/WikiLambda@master] Function-editor: Keep languages of the editor in sync with the root zObject, and therefore the Work Summary.

Reason:

change included as part of 831619

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

Change 830125 restored by Dani DW:

[mediawiki/extensions/WikiLambda@master] Function-editor: Keep languages of the editor in sync with the root zObject, and therefore the Work Summary.

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

This has been broken into four tasks:
T317650: language selectors should not have the ability to clear.
T317648: edit and create function view should be the same.
T317646: languages should keep in sync in function view and editor.
T317653: title and labels should behave the same on language change (neither should be remembered in relation to a language).

There is also a separate task for the higher level discussion of the design of the function editor; namely defining the relationship between language selector and label fields and therefore how changing language impacts the already typed fields.

All four development tasks have been addressed and are closed.

I am now closing this task, as we can address T317666 separately.

Thanks, @Ddwaal-WMF, for addressing all of these and documenting them clearly <3