Page MenuHomePhabricator

Lookup: expose focus() method
Closed, ResolvedPublic3 Estimated Story Points

Description

Lookup does not appear to expose any methods which allow focusing on the underlying TextInput component. focus is a public method exposed by TextInput. Lookup should also expose a focus() method which will allow end-users to focus on a specific Component.

This is preventing us from adding autofocus to a Vue-injected field at T153988: Migrate Special:Nuke to Codex. It's technically possible to use this.$refs.lookupComponent._.refs.textInput.focus() (where lookupComponent is a ref attached to a Lookup), though this is a completely inelegant solution and involves accessing the target object of the Proxy returned by this.$refs (which should be private).

Event Timeline

Let's get this done so we can push T153988 over the finish line.

Change #1298780 had a related patch set uploaded (by Samtar; author: Samtar):

[design/codex@main] components/lookup: Expose focus() method

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

Change #1298780 merged by jenkins-bot:

[design/codex@main] Lookup: Expose focus() method

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

Change #1299580 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/core@master] Update Codex from v2.5.1 to v2.6.0

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

Change #1299580 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v2.5.1 to v2.6.0

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

@jsn.sherman will throw together a user script to test this easily on one of the production environments.

Scardenasmolinar moved this task from QA to Done on the Moderator-Tools-Team (Kanban) board.

Can confirm that this is working. Tested it with the console in Special:Block.