Page MenuHomePhabricator

TypeaheadSearch: Minerva focuses main search field when selecting a InputBox search field
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • The main search field receives focus
  • mediawiki.page.ready has installed a focus handler on all search inputs
  • this handler loads the skins.minerva.search module
  • the skins.minerva.search module loads the Vue typeahead search widget
  • this widget somehow assumes it is only loaded for the main search field and give focus to that field.

Search inputs selected by page ready module:

return element.id === 'searchInput' ||
        element.classList.contains( 'mw-searchInput' );

This never used to be a problem because the old searchsuggest module supported multiple search inputs, but the new one only supports 'main search'.

What should have happened instead?:

  • The clicked search field receives focus

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

TheDJ renamed this task from Minerva focuses main search field when selecting a InputBox search field to TypeaheadSearch: Minerva focuses main search field when selecting a InputBox search field.Nov 16 2025, 1:37 PM
TheDJ updated the task description. (Show Details)

autofocusInput on mount.. but the reason for mounting the app is not necessarily correlated with providing focus to the element on which it mounts... So this autofocusInput logic should be fixed...

It should register if the element being infused has focus, remember that, and then when mounted, should move the focus, and otherwise not do anything. we shouldn't need an autofocus flag I think...

I'm not entirely sure why there is no factory/hydration method for the module, and instead we are reimplementing half the property extraction logic for the app inside the skins.. this seems like a lot of code duplication. ? A common method could take a form element reference and the input element reference and determine half the properties without each skin having to figure it out on its own.

Change #1206961 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/skins/MinervaNeue@master] Search: Only focus search if it is the active element

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