Page MenuHomePhabricator

Provide option for OO.ui.mixin.LookupElement to only show suggestions after the user pressed a key
Closed, ResolvedPublic

Description

OO.ui.mixin.LookupElement should have an option to only show suggestions after the user pressed a key, and not just on focus. This is different from the current allowSuggestionsWhenEmpty option, as the input might have some pre-filled value. Even then I would like to show suggestions not when the user focuses the input, but only once they type in some additional text.
The place I want to use this is https://de.wikipedia.org/wiki/Benutzer:Schnark/js/veSummary.js, which provides suggestions for the edit summary in VE. It should mimic the usual browser behavior for autocompleting forms, which is as described: You don't get suggestions directly after focusing, but only once you interacted with the input.
Currently I just override the onLookupInputFocus method to suppress showing the suggestions there, but as this method officially is protected, this certainly is not the best way to do it.

Details

Related Gerrit Patches:
mediawiki/extensions/VisualEditor : masterMWEditSummaryWidget: Use showSuggestionsOnFocus flag
mediawiki/core : masterUpdate OOUI to v0.32.0
oojs/ui : masterLookupElement: Add showSuggestionsOnFocus flag

Event Timeline

Schnark created this task.Jul 3 2017, 7:33 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 3 2017, 7:33 AM
Esanders updated the task description. (Show Details)Apr 5 2019, 12:46 PM

Change 501559 had a related patch set uploaded (by Esanders; owner: Esanders):
[oojs/ui@master] LookupElement: Add showSuggestionsOnFocus flag

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

A workaround for this exists in ve.ui.MWEditSummaryWidget, and can be removed once this is closed.

Change 512343 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] MWEditSummaryWidget: Use showSuggestionsOnFocus flag

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

matmarex moved this task from Backlog to Reviewing on the OOUI board.May 24 2019, 5:43 PM

Change 501559 merged by jenkins-bot:
[oojs/ui@master] LookupElement: Add showSuggestionsOnFocus flag

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

Change 513020 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[mediawiki/core@master] Update OOUI to v0.32.0

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

Change 513020 merged by jenkins-bot:
[mediawiki/core@master] Update OOUI to v0.32.0

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

Change 512343 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] MWEditSummaryWidget: Use showSuggestionsOnFocus flag

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