I have a div element that can get keyboard focus:
<div tabindex="0" onkeydown="myListener(event);">
<span>Some display text</span>
</div>
My root problem is that mobile devices do not display the soft keyboard when a <div>
gets focus, so I have written my own soft keyboard that I can display on focus and hide on blur. But I would like to only display my soft keyboard if the user has no hard keyboard attached.
Is there any way for me to detect the absence of a physical keyboard? Currently, I display the soft keyboard until I see a keyboard event, and then permanently hide the soft keyboard, but that's pretty inelegant.