From 5249b67f33fa00d6378816c6ea4f61370af8f293 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 23 May 2024 08:49:42 +0700 Subject: [PATCH] fix(web): pre-init keyboard activation awaits init before proceeding Fixes: #11504 Cherry-pick-of: #11505 --- web/src/app/webview/src/contextManager.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/src/app/webview/src/contextManager.ts b/web/src/app/webview/src/contextManager.ts index a2450ad58c..be0a9bae5a 100644 --- a/web/src/app/webview/src/contextManager.ts +++ b/web/src/app/webview/src/contextManager.ts @@ -155,6 +155,18 @@ export default class ContextManager extends ContextManagerBase { + /* + this.keyboardCache isn't set until partway through KMW initialization. + Also, keyboard stubs aren't processed until initialization is complete, + so it's best to wait for initialization anyway. + */ + if(!this.engineConfig.deferForInitialization.isFulfilled) { + await this.engineConfig.deferForInitialization.corePromise; + + // Our mobile app-engines all register the stub before attempting to set the keyboard, + // so the Promise ordering here should work in our favor. + } + // If the default keyboard is requested, load that. May vary based on form-factor, which is // part of what .getFallbackStubKey() handles. if(!keyboardId) {