The CSS snippet uses more resources than the Capacitor listener; I didn’t use the exact snippet, but before I went down the CodeScript ToolKit rabbit hole I had CSS inspired by that one as well as this thread to show the bottom status bar on mobile when the keyboard is open and I noticed a tad bit of lag with it.
I’m sure my code can be edited a little to be more sexy; like sliding out the app header when the keyboard is opened rather than just disappearing it, but I mostly made and posted it for others to use since I remembered this thread while looking through the Capacitor API.
In terms of detecting the keyboard, it should be exactly how it would be done natively.