Rich text mode should be the default in Flow replies
Closed, ResolvedPublic

Description

Currently Flow input areas are shown by default using wikitext mode by default. Even when changed to rich text mode, the next time a reply box is still shown in wikitext mode.

In the current context, rich text mode seems a more reasonable default considering the type of content (conversations) and the tools provided (e.g., easy access to mentions).

Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptJan 18 2017, 8:17 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I've also noticed that change but I didn't took time to explore it.

That was not the case earlier (aka a couple of days ago): rich mode was default, the last editor you used is then the one you have when you post or reply.

Bug? Config change(d)?

Note that I'm logged in.

This comment was removed by Trizek-WMF.

On mw.org, while logged in and cleaning my cache after every test:

  1. If I switch from VE to wikitext, and then don't publish any edit, I'm stick with wikitext.
  2. If I switch from wikitext to VE, and then don't publish any edit, I'm stick with wikitext.
  3. If I switch from wikitext to VE, and then publish something, I'm stick with wikitext.
  4. If I switch from VE to wikitext, and then publish something, I'm back on VE.
  5. If I type something in wikitext and then switch to VE, I'm stick with wikitext.
  6. If I type something in VE and then switch to wikitext, I'm stick with wikitext.

There is a lack of consistency, don't you think? :)

The way it's supposed to work currently is that it stores a per-user preference, which changes when you change the text of an edit box (https://github.com/wikimedia/mediawiki-extensions-Flow/blob/71e04ff364650c61c5089e6eff448bece58e0b88/modules/flow/ui/widgets/editor/mw.flow.ui.EditorSwitcherWidget.js#L474). It's based on when you modify the text box, not when you save.

For example:

  1. My preference is currently set to 'wikitext', so it opens as a 'wikitext' editor.
  2. I switch to VE.
  3. I type into the VE box.

The preference is now supposed to be set to VE.

It's not clear that all of the test cases above are testing the right thing, but #6 does look like a bug (assuming you didn't type anything into the wikitext box). It should switch the preference to VE when you type into that.

Etonkovidova added a subscriber: Etonkovidova.EditedJan 19 2017, 10:08 PM

For cases #5 and #6: It seems that the typing action defines which editor will be set as preferred for your next visit.

@Trizek-WMF , please confirm that for #6

If I type something in VE and then switch to wikitext, I'm stick with wikitext.

the steps were as following:

  1. Click 'Reply' - the wikitext editor is displayed.
  2. Switch to VE
  3. Type something in VE
  4. Switch to wikitext - and without typing anything else, click 'Save'.
  5. Opening another Reply or Edit will give you VE.

I'll do more testing to prove(or disprove) that the typing action defines the saved preference for an editor.

Etonkovidova added a comment.EditedJan 19 2017, 10:57 PM

All testing done in mediawiki (wmf.8)
Logged in user: The editor, in which the last typing (editing) action took place, will be the editor that become saved as a user preferences.

Initial editorTyping actionSwitchTyping action after switchSaveEditor saved
VEno typingswitch to wikitexttyping in wikitextswitch back to VE and Savewikitext
VEtyping in VEswitch to wikitextno typingSave in wikitext modeVE
  • The typing action may be as small as entering a white space or press Enter, it still is counted as an edit and the editor in which it was done becomes the preferred editor.
  • Opening a post for edit and pressing 'Save' without modifying the content, will not affect the preferred editor setting.

For anon users (the case reported in this ticket), the wikitext editor is the "preferred" one; the choice for last editor (and typing) is disregarded, although there is a curious short delay.

jmatazzoni added a comment.EditedJan 19 2017, 11:31 PM

Here is what I just did (two times, on a Mac using Chrome):

  • Log in to test.wiki
  • Go to Main Page discussion page and click to start a new topic.
  • The tool is in Wikitext mode.
  • Switch to Visual mode.
  • Write comment and click to Add Topic. Topic is added with my signature (confirming I'm logged in).
  • Close browser tab. Open new tab and return to the Flow page.
  • Click into the Reply box of my new topic.
  • Find myself back in Wikitext mode.

I just did the test above a third time. This time the VE setting stuck. So... it works sometimes?

For cases #5 and #6: It seems that the typing action defines which editor will be set as preferred for your next visit.

@Trizek-WMF , please confirm that for #6

If I type something in VE and then switch to wikitext, I'm stick with wikitext.

the steps were as following:

  1. Click 'Reply' - the wikitext editor is displayed.
  2. Switch to VE
  3. Type something in VE
  4. Switch to wikitext - and without typing anything else, click 'Save'.
  5. Opening another Reply or Edit will give you VE.

    I'll do more testing to prove(or disprove) that the typing action defines the saved preference for an editor.

I have the same result as you, following your steps.

@jmatazzoni

If instead of your step

Close browser tab. Open new tab and return to the Flow page.

you would open a different browser, then the VE setting will stick.

The setting for VE editor(up_property: flow-editor) gets promptly saved. Opening another tab apparently gets cached(?), so the browser tab serves outdated settings.

Note: up_property: flow-editor is set for every Flow page, not only for the particular Flow board on which the selection of the editor took place.

@jmatazzoni

If instead of your step

Close browser tab. Open new tab and return to the Flow page.

you would open a different browser, then the VE setting will stick.

The setting for VE editor(up_property: flow-editor) gets promptly saved. Opening another tab apparently gets cached(?), so the browser tab serves outdated settings.

Ahhh. Interesting. I don't think you were suggesting that the current functionality is correct, but just to be clear: our goal, I think, is that the setting should stick even if the user closes the browser, shuts down the computer, etc. Is that a change in the spec? Or is that how it was always supposed to work?

@jmatazzoni The setting is saved in database per a user, so the setting is stuck. Even if a user log in after shutting down the computer, or installs a new browser, or login from a new computer.

This is what I've found in my testing so far:

Saving a new topic sets the preference to the current editor even if no edit was made with this editor

This is caused by the resetting of the form on save (widget.editor.setContent( '', 'html' );), which triggers a content change and an API call to change the preference.

Steps:
  1. Open a Flow board
  2. Make sure the preference is set to VE. If not, set it to VE and reload the board.
  3. Start a new topic with the current editor (VE)
  4. Switch to wikitext
  5. Save the new topic
  6. Start a new topic. The editor should be VE but it's wikitext.

Starting, cancelling, and re-starting a reply to a topic opens the editor in its previous state regardless of the preference

This is caused by the instance of ReplyWidget being kept as-is if it was previously activated.

Steps:
  1. Open a Flow board
  2. Make sure the preference is set to VE. If not, set it to VE and reload the board.
  3. Start a reply to a topic
  4. Switch to wikitext
  5. Cancel the reply
  6. Re-open the reply form for the same topic and post. It should open with VE since it's still the preferred editor but it open with wikitext.

Edit board description form always open with the editor that was configured the first time it was opened

This is caused by the BoardDescriptionWidget keeping its instance of EditorWidget, which favors this.initialEditor over the current value of the user preference.

Steps:
  1. Open a Flow board
  2. Make sure the preference is set to VE. If not, set it to VE and reload the board.
  3. Open the edit description form. It opens the VE editor. Close it.
  4. Start a new topic, switch to wikitext and type some text to change the preference. Saving or cancelling doesn't change anything.
  5. Open the edit description form. It should be wikitext but it's still VE.

The tests above can be executed by swapping VE and wikitext with the same, but reversed, results.

This is what I've found in my testing so far:

== Saving a new topic sets the preference to the current editor even if no edit was made with this editor
This is caused by the resetting of the form on save (widget.editor.setContent( '', 'html' );), which triggers a content change and an API call to change the preference.

==== Steps:

  1. Open a Flow board
  2. Make sure the preference is set to VE. If not, set it to VE and reload the board.
  3. Start a new topic with the current editor (VE)
  4. Switch to wikitext
  5. Save the new topic
  6. Start a new topic. The editor should be VE but it's wikitext.

In this scenario, I don't understand why you say, in step #6, "The editor should be VE." I thought the editor was meant to stay in whatever was the last save?

Before we can discuss the optimal behavior, I suppose I need to know what we think the currently specified behavior is?

This is what I've found in my testing so far:

== Saving a new topic sets the preference to the current editor even if no edit was made with this editor
This is caused by the resetting of the form on save (widget.editor.setContent( '', 'html' );), which triggers a content change and an API call to change the preference.

==== Steps:

  1. Open a Flow board
  2. Make sure the preference is set to VE. If not, set it to VE and reload the board.
  3. Start a new topic with the current editor (VE)
  4. Switch to wikitext
  5. Save the new topic
  6. Start a new topic. The editor should be VE but it's wikitext.

In this scenario, I don't understand why you say, in step #6, "The editor should be VE." I thought the editor was meant to stay in whatever was the last save?

I'm 90% positive that the spec was to set the user's preferred editor when a change to the content is made using that editor. Toggling between wikitext and VE is also used for the "preview" feature and does not constitute an actual content change.

Change 334132 had a related patch set uploaded (by Sbisson):
Always open the editor configured in the 'flow-editor' preference

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

Change 334176 had a related patch set uploaded (by Sbisson):
Don't set Flow preferences in hooks

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

It turns out Flow was configured to use VE by default for anons and new users but a bug prevented that config from being taken into account. The patch above fixes it.

So now we have:

  • VE for anons, always
  • last editor used when a change is published for logged-in users

Correct?

So now we have:

  • VE for anons, always

Initial value for anons is VE. They can change it to wikitext and that change will be "sticky" on the current page but will reset to default (VE) on reload or navigation.

Initial value for new users is VE.

  • last editor used when a change is published for logged-in users Correct?

Not sure what you mean by "published" here. The preference is updated when a content change is made in the editor, literally when it is typed in, not when it is saved or when the editor is switched.

Trizek-WMF added a comment.EditedJan 25 2017, 7:47 PM
  • last editor used when a change is published for logged-in users Correct?

Not sure what you mean by "published" here. The preference is updated when a content change is made in the editor, literally when it is typed in, not when it is saved or when the editor is switched.

Ok, got it. [edited, because misread]

Thanks!

Change 334176 merged by jenkins-bot:
Don't set Flow preferences in hooks

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

Change 334132 merged by jenkins-bot:
Always open the editor configured in the 'flow-editor' preference

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

@SBisson summarized the behavior of the editor preference:

The preference is updated when a content change is made in the editor, literally when it is typed in, not when it is saved or when the editor is switched.

Also, VE editor is a default editor for anon and new users (upon first login).

Checked the fix in betalabs (including re-checking the test scenarios @SBisson listed above). Except, the scenario "Saving a new topic sets the preference to the current editor even if no edit was made with this editor" - it's not clear how a new topic can be saved without adding a post.

Keep in mind that the act of typing sets the editor preference; the content changes do not need to be saved in order to reset the preference. e.g.

  1. A user switches to wikitext editor
  2. Types something in wikitext
  3. The user decides not to save it and hits 'Cancel'. The preference editor will be set to wikitext anyway.

Or a user starts a new topic, changes the editor, types only the topic title and then hits 'Cancel'. The editor choice will be preserved.

QA recommendation: Product should weigh in.

jmatazzoni closed this task as Resolved.Feb 7 2017, 9:43 PM

this sounds fine. Thanks all. Resolving topic.