Page MenuHomePhabricator

Always activate autocompletion when typing page titles
Closed, ResolvedPublic

Description

Follow up to T95100: Add autocompletion to CodeMirror extension

Reported on enwiki at https://en.wikipedia.org/wiki/Special:Permalink/1300873436#How_to_fully_enable_the_page_title_autocomplete

I believe we made the title autocompletion for the MediaWiki mode opt-in via keystroke because this was the recommendation of the upstream library. However Wikimedians will prefer and expect autocompletion to act like the search bar, with suggestions added for each and every keystroke.

Provided we store the promise for the latest API request in a variable, and abort it before issuing a new request, there should be no performance concerns. There is also mw.util.throttle() if we need it.

It may make sense to still keep the + shortcut, say to re-trigger suggestions after accidentally dismissing them.

Event Timeline

Do you mean that we also want to drop validFor?

Do you mean that we also want to drop validFor?

Yes, I think so! Re-reading the upstream docs, it looks like CodeMirror is trying to offer performance optimizations on behalf of the server. The filter option for example should probably be false. The MediaWiki search backend will know better on what to suggest when it comes to page titles. I don't think we'd want to add other completion sources, either, as that could get confusing. I see CM may also have a means to abort the query. It may be more appropriate to use that over the mw.Api helpers. Same with throttling.

Change #1191871 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] CodeMirrorAutocomplete: retrigger opensearch on typing

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

Change #1191871 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirrorAutocomplete: retrigger opensearch on typing

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

Bhsd moved this task from Improvement to Done on the MediaWiki-extensions-CodeMirror board.