Page MenuHomePhabricator

DEFAULTSORT not recognized by VisualEditor
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

What happens?:
Nonexistent template "DEFAULTSORT:Joseph, Saint" appears at the bottom. In Options, "Sort this page by default as" is set to Saint_Joseph. If you set it something else, apply changes, and switch to source editing, an extra {{DEFAULTSORT:...}} is appended at the end despite the extant tag.

1.png (147×420 px, 6 KB)
2.png (125×498 px, 2 KB)

What should have happened instead?:
{{DEFAULTSORT:...}} is not recognized as a template but in "Sort this page by default as". Changing it in the dialog modifies the existing tag rather than add a new one.

Other information:
Happening on some pages but not on others. In the first ten results for :insource:"defaultsort", the bug is reproducible on

but not on

Also reproducible while creating a new page with just {{DEFAULTSORT:...}} (or with nothing, so switching to VE, adding one in the dialog, and switching back keeps adding new tags).

Event Timeline

Nardog renamed this task from DEFAUTLSORT not recognized by VisualEditor to DEFAULTSORT not recognized by VisualEditor.May 24 2023, 1:41 PM
Nardog added a project: Regression.
matmarex subscribed.

Comparing the Parsoid outputs:

https://en.wikipedia.org/api/rest_v1/page/html/Saint_Joseph/1152713325?redirect=false&stash=true

<span about="#mwt733" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DEFAULTSORT:Joseph, Saint","function":"defaultsort"},"params":{},"i":0}}]}' id="mwBzk"></span>

https://en.wikipedia.org/api/rest_v1/page/html/Jon_Bon_Jovi/1152256144?redirect=false&stash=true

<meta property="mw:PageProp/categorydefaultsort" content="Bon Jovi, Jon" id="mwBWk"/>

Yes, this changed with https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/908937 ... our support for it has always been broken and we removed that bandaid. But, we should chat if we need any heuristics for some use cases.

EDIT: I also updated https://www.mediawiki.org/wiki/Specs/HTML/2.7.1 (was on my todo list but took this opportunity to update it there).

Almost all articles on jawiki have custom sortkeys fwiw. insource:"defaultsort" and insource:"デフォルトソート" returned 1,307,925 out of all 1,374,785 articles. I'm sure there are other such languages.

@ssastry What do you mean by "heuristics for some use cases"? Surely we can't leave VE's existing support for sortkeys (in the dialog) broken, and while we might as well remove it for the time being, VE must support sortkeys one way or another, or communities like jawiki would continue to be heavily inconvenienced by the lack of support.

We will chat with the Editing team as to how to handle this.

MSantos edited projects, added Parsoid (Tracking); removed Parsoid.

@ssastry @matmarex Any update? If you're not fixing it anytime soon I suggest that a User-notice is in order.

ssastry added a subscriber: Batorsz.

Thanks @Nardog for the ping. @Batorsz is exploring how soon their team can get it fixed but he recommends a user-notice in any case. So, I am going to add it.

Thanks. I assume you mean @matmarex, not @Batorsz.

Thanks. I assume you mean @matmarex, not @Batorsz.

Ugh .. yes. :)

...communities like jawiki would continue to be heavily inconvenienced by the lack of support.

@Nardog can you please say more what "inconvenienced" might mean in this context? You described the impact of this issue in the description (thank you!) [i] and you sharing the above about ja.wiki leads me to be wonder whether there are other implications we might not yet be aware of/considering.


i. People attempting to edit DEFAULTSORT values in VE will notice an extra and unexpected DEFAULTSORT value within the content of the article they are editing and people viewing category pages might notice pages be ordered in unexpected ways.

On nlwiki I see this on all pages with a DEFAULTSORT and we use this heavily on pages about people. We want to sort them on lastname and the article name is Firstname Lastname.
We can't edit the value for DEFAULTSORT in VE, since it's a non-existing template for VE. And in the category section of VE, no value is visible.

insource:{{DEFAULTSORT gives 382.864 results on nlwiki in main namespace.

people viewing category pages might notice pages be ordered in unexpected ways.

This would be very bad, but there is no evidence this is happening.

@Nardog can you please say more what "inconvenienced" might mean in this context? You described the impact of this issue in the description (thank you!) [i] and you sharing the above about ja.wiki leads me to be wonder whether there are other implications I might not yet be aware of/considering.

  • Any user who is accustomed to editing via VE would have to switch to source editor in order to edit DEFAULTSORT.
  • DEFAULTSORT currently shows up as a broken template in VE, so it may be accidentally removed.
  • The "Sort this page by default as" feature currently ignores any existing DEFAULTSORT, so users might think it's missing and add one even though it is not, wasting the time and energy of both the user and anyone who cleans up after it.
  • It also inserts DEFAULTSORT at the very end of the source rather than before categories as is the established convention. This would have to be cleaned up, which means both extra human hours that could have been spent elsewhere and more opportunities for mistakes to occur.

I'm a bit confused by your query as these are pretty obvious points to me. If this is not the kind of answer you were looking for, please clarify.

Re: Tech News - What wording would you suggest as the content? From the discussion above, I'm not sure how to summarize the issue, nor the expected resolution, nor how to describe any requested actions (if any?) from editors. Thanks!

I assume something like:

Currently, the "Sort this page by default as" feature in VisualEditor is broken. Existing {{DEFAULTSORT:...}} keywords incorrectly appear as missing templates in VisualEditor. Developers are exploring how to fix this. In the meantime, those wishing to edit the default sortkey of a page are advised to switch to source editing.

Someone has just complained about this on the Hebrew Wikipedia, and it still happens there.

Another related issue is that when adding DEFAULTSORT using VE in the Hebrew Wikipedia, it uses the source magic word DEFAULTSORT and not the localized מיון רגיל. Should I report it separately, or is it caused by the same problem?

Another related issue is that when adding DEFAULTSORT using VE in the Hebrew Wikipedia, it uses the source magic word DEFAULTSORT and not the localized מיון רגיל. Should I report it separately, or is it caused by the same problem?

T87382: VisualEditor should insert localised DEFAULTSORT: (SORTUJ:) in Polish

Change 972928 had a related patch set uploaded (by Nardog; author: Nardog):

[mediawiki/extensions/VisualEditor@master] Recognize DEFAULTSORT again

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

Another related issue is that when adding DEFAULTSORT using VE in the Hebrew Wikipedia, it uses the source magic word DEFAULTSORT and not the localized מיון רגיל. Should I report it separately, or is it caused by the same problem?

T87382: VisualEditor should insert localised DEFAULTSORT: (SORTUJ:) in Polish

Now that Parsoid no longer even recognizes DEFAULTSORT, that task seems moot. T154669 is closer to what Amire80 describes (and my patch addresses).

DLynch edited projects, added Editing-team (Kanban Board); removed Editing-team.
DLynch moved this task from Incoming to QA on the Editing-team (Kanban Board) board.
DLynch added a project: Editing QA.

Change 972928 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Recognize DEFAULTSORT again

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

Thank you for writing the patch @Nardog!

The bug was announced in Tech News (https://meta.wikimedia.org/wiki/Tech/News/2023/24), we should probably announce the fix as well :)

Do you (anyone) have any suggested wording for the Tech News entry? I'd guess at something like this, but perhaps there is more detail to add?

Recent changes

  • The {{DEFAULTSORT:...}} system is working again in VisualEditor, after the previously mentioned problems. (1) (2) (3)
NOTE: Edited.

How about something that corresponds to the previous news, like:

The "Sort this page by default as" feature in VisualEditor is working again. You no longer need to switch to source editing to edit {{DEFAULTSORT:...}} keywords.

I also suggest it go out after the deployment of the patch (2023-48?).

@Nardog As it didn't make it in the last Tech News edition (diff of removal), should it go into the next issue? (I.e. IIUC, the only relevant patch was merged on the 16th, and should be getting deployed as part of the train this week (MediaWiki 1.42/wmf.7), but I might be missing/misunderstanding something?) Thanks!

@Quiddity I see it's been deployed, so next issue seems fine to me. Thank you for the heads-up.