jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/334698 )
Change subject: Do not lazy load search to focus search input in overlay in ios ...................................................................... Do not lazy load search to focus search input in overlay in ios We already load mobile.search at startup so the request to mw.loader.using is unnecessary and delays the display of search. This makes this a synchronous event. It seems there is no issues in calling focus from inside a click event (presumably as it signals a user interaction) Bug: T156508 Change-Id: I02a72a62ac5db899b329f5594a55c5ac7cbfcd66 --- M extension.json M resources/skins.minerva.scripts/search.js 2 files changed, 14 insertions(+), 15 deletions(-) Approvals: Bmansurov: Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index de820c8..a32cfa7 100644 --- a/extension.json +++ b/extension.json @@ -1562,6 +1562,7 @@ "mobile.startup", "mobile.mainMenu", "mobile.issues", + "mobile.search.api", "mobile.search", "mobile.references", "mobile.betaoptin", diff --git a/resources/skins.minerva.scripts/search.js b/resources/skins.minerva.scripts/search.js index 6901aac..bed8095 100644 --- a/resources/skins.minerva.scripts/search.js +++ b/resources/skins.minerva.scripts/search.js @@ -1,5 +1,6 @@ ( function ( M, $ ) { - var SearchOverlay, SearchGateway, + var SearchOverlay = M.require( 'mobile.search/SearchOverlay' ), + SearchGateway = M.require( 'mobile.search.api/SearchGateway' ), router = require( 'mediawiki.router' ), browser = M.require( 'mobile.browser/Browser' ).getSingleton(); @@ -15,20 +16,17 @@ placeholder = $this.attr( 'placeholder' ); ev.preventDefault(); - - mw.loader.using( [ 'mobile.search.api', 'mobile.search' ] ).done( function () { - SearchGateway = M.require( 'mobile.search.api/SearchGateway' ); - SearchOverlay = M.require( 'mobile.search/SearchOverlay' ); - - new SearchOverlay( { - router: router, - gatewayClass: SearchGateway, - api: new mw.Api(), - searchTerm: searchTerm, - placeholderMsg: placeholder - } ).show(); - router.navigate( '/search' ); - } ); + // The loading of SearchOverlay should never be done inside a callback + // as this will result in issues with input focus + // see https://phabricator.wikimedia.org/T156508#2977463 + new SearchOverlay( { + router: router, + gatewayClass: SearchGateway, + api: new mw.Api(), + searchTerm: searchTerm, + placeholderMsg: placeholder + } ).show(); + router.navigate( '/search' ); } // Only continue on mobile devices as it breaks desktop search -- To view, visit https://gerrit.wikimedia.org/r/334698 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I02a72a62ac5db899b329f5594a55c5ac7cbfcd66 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: branding Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits